word复制过来公式会丢,放图片吧
图片说明
代码如下

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define ms(a) memset(a,0,sizeof(a))
typedef long long ll;
#define endl '\n'
#define maxn 1000001
const ll mod=998244353;

ll f[maxn],invf[maxn];//阶乘和阶乘逆元
//扩欧求逆元
template<typename T>
T exgcd(T _a, T _b, T& _x, T& _y)
{
    if (_b == 0)
    {
        _x = 1; _y = 0;
        return _a;
    }
    T res = exgcd(_b, _a % _b, _y, _x);
    _y -= _a / _b * _x;
    return res;
}
//逆元
template<typename T>
T inv(T _x, T _mod)
{
    T res, tmp;
    exgcd(_x, _mod, res, tmp);
    if (res < 0) res += _mod;
    return res;
}
void init()
{
    const int N=1000000;
    f[0]=1;
    for(int i=1;i<=N;i++) f[i]=(i*f[i-1])%mod;
    invf[N]=inv(f[N],mod);
    for(int i=N-1;i>=0;i--) invf[i]=(i+1)*invf[i+1]%mod;
}
inline ll C(int n,int m)
{
    return f[n]*invf[n-m]%mod*invf[m]%mod;
}
int main()
{
    int t,n,m,k;
    cin>>t;
    init();
    while(t--)
    {
        cin>>n>>m>>k;
        int mp=min(n-k,m-k);
        ll ans=0;
        for(int i=0;i<=mp;i++)
        {
            ans+=C(k+i-1,i)*C(n-i-1,n-k-i)%mod*C(m-i-1,m-k-i)%mod;
            ans%=mod;
        }
        cout<<ans<<'\n';
    }
    return 0;
}