結果
問題 | No.420 mod2漸化式 |
ユーザー |
![]() |
提出日時 | 2022-08-08 01:07:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 18 ms / 1,000 ms |
コード長 | 625 bytes |
コンパイル時間 | 2,165 ms |
コンパイル使用メモリ | 192,628 KB |
最終ジャッジ日時 | 2025-01-30 19:21:23 |
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 35 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; const int k=32; ll nCr[k][k]; void init(){ rep(i,k) nCr[i][0]=1; rep(i,k) nCr[i][i]=1; for(int i=2;i<k;i++){ for(int j=1;j<i;j++){ nCr[i][j]=nCr[i-1][j-1]+nCr[i-1][j]; } } } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); init(); ll x; cin>>x; if(x>=32) cout<<"0 0"<<endl; else if(x==0) cout<<"1 0"<<endl; else{ ll ans=(1LL<<31)-1; ans*=nCr[30][x-1]; cout<<nCr[31][x]<<" "<<ans<<endl; } return 0; }