結果
問題 | No.420 mod2漸化式 |
ユーザー |
![]() |
提出日時 | 2016-09-22 15:47:11 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 440 bytes |
コンパイル時間 | 588 ms |
コンパイル使用メモリ | 54,492 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 13:03:46 |
合計ジャッジ時間 | 1,755 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 35 |
ソースコード
#include <iostream> using namespace std; long long ncm[50][50]; int main(){ int n; cin>>n; if(n>31){ cout<<"0 0"<<endl; return 0; } ncm[0][0]=1; for(int i=0;i<40;i++){ for(int j=0;j<=i;j++){ ncm[i+1][j]+=ncm[i][j]; ncm[i+1][j+1]+=ncm[i][j]; } } long long ret=1; //the first answer is 32Cn. //the second andswer is 2^32*31C(n-1). cout<<ncm[31][n]<<" "<<((1LL<<31)-1)*ncm[30][n-1]<<endl; return 0; }