結果
| 問題 |
No.420 mod2漸化式
|
| コンテスト | |
| ユーザー |
dnish
|
| 提出日時 | 2017-05-04 13:02:59 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 469 bytes |
| コンパイル時間 | 1,498 ms |
| コンパイル使用メモリ | 165,644 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 07:03:58 |
| 合計ジャッジ時間 | 2,600 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 35 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:22:46: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
22 | cout<<C[31][x]<<" "<<((1<<31)-1)*C[30][x-1]<<endl;
| ~~~~~~~^~
ソースコード
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int)N;i++)
#define p(s) cout<<(s)<<endl
typedef long long ll;
using namespace std;
ll C[35][35];
void combination(){
REP(i,0,32) C[i][0]=C[i][i]=1;
REP(i,2,32) REP(j,1,32){
C[i][j]=C[i-1][j-1]+C[i-1][j];
}
}
int main(){
int x;
cin>>x;
if(x>31) cout<<0<<" "<<0<<endl;
else if(x==0) cout<<1<<" "<<0<<endl;
else{
combination();
cout<<C[31][x]<<" "<<((1<<31)-1)*C[30][x-1]<<endl;
}
return 0;
}
dnish