結果
問題 | No.2527 H and W |
ユーザー |
![]() |
提出日時 | 2024-08-09 22:45:08 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 41 ms / 2,000 ms |
コード長 | 1,678 bytes |
コンパイル時間 | 6,308 ms |
コンパイル使用メモリ | 336,424 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-08-09 22:45:16 |
合計ジャッジ時間 | 7,079 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll=long long; #define rep(i,a,b) for(it i=(it)(a);i<=(it)b;i++) #define nrep(i,a,b) for(it i=(it)(a);i>=(it)b;i--) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define moda 998244353LL #define modb 1000000007LL #define dai 2500000000000000000LL #define tyu 2500000000 #define en 3.14159265358979 #define sho -dai #define eps 1e-14 #define yn(x) cout<<(x ? "Yes":"No")<<endl; #define YN(x) cout<<(x ? "YES":"NO")<<endl; using it=long long; using un=unsigned long long; using db=long double; using st=string; using ch=char; using bo=bool; using P=pair<it,it>; using mint=modint; using mints=modint998244353; using vi=vector<it>; using vd=vector<db>; using vs=vector<st>; using vc=vector<ch>; using vb=vector<bo>; using vp=vector<P>; using vm=vector<mint>; using sp=set<P>; using ss=set<st>; using sc=set<ch>; using si=set<it>; using svi=set<vi>; using vvi=vector<vi>; using vvd=vector<vd>; using vvs=vector<vs>; using vvb=vector<vb>; using vvc=vector<vc>; using vvp=vector<vp>; using vvm=vector<vm>; using vsi=vector<si>; using vsp=vector<sp>; using vvsi=vector<vsi>; using vvsp=vector<vsp>; using vvvi=vector<vvi>; using vvvd=vector<vvd>; using vvvvi=vector<vvvi>; map<P,it> memo; it ccr(it c,it r){ mint::set_mod(moda); if(memo.count({c,r}))return memo[{c,r}]; r=min(r,c-r); mint bunsi=1,bunbo=1; rep(i,c-r+1,c)bunsi*=i; rep(i,1,r)bunbo*=i; it e=(bunsi/bunbo).val(); memo[{c,r}]=e; return e; } int main(){ it h,w,k,ans=0;cin>>h>>w>>k; rep(i,1,h) if(k%i==0&&k/i<=w)ans+=ccr(h,h-i)*ccr(w,w-k/i)%moda; cout<<ans%moda<<endl; }