結果
| 問題 |
No.2527 H and W
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-03 21:27:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 355 ms / 2,000 ms |
| コード長 | 884 bytes |
| コンパイル時間 | 1,638 ms |
| コンパイル使用メモリ | 166,744 KB |
| 実行使用メモリ | 19,072 KB |
| 最終ジャッジ日時 | 2024-09-25 19:08:35 |
| 合計ジャッジ時間 | 11,865 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int p=998244353;
int po(int a,int b) {if(b==0) return 1; if(b==1) return a; if(b%2==0) {int u=po(a,b/2);return (u*u)%p;} else {int u=po(a,b-1);return (a*u)%p;}}
int inv(int x) {return po(x,p-2);}
const int maxn=1e6+5;
int fact[maxn];int invf[maxn];
int c(int n,int k)
{
int ans=fact[n];ans*=invf[k];ans%=p;ans*=invf[n-k];ans%=p;return ans;
}
int32_t main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
fact[0]=1;for(int i=1;i<maxn;++i) {fact[i]=(fact[i-1]*i)%p;} for(int i=0;i<maxn;++i) invf[i]=inv(fact[i]);
int n,m,k;cin>>n>>m>>k;
int res=0;
for(int i=1;i<=n;++i)
{
if(k%i==0)
{
int j=k/i;
if(j<=m)
{
res+=c(n,i)*c(m,j);res%=p;
}
}
}
cout<<(res%p+p)%p;
return 0;
}