結果
| 問題 | No.420 mod2漸化式 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-16 22:31:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 1,000 ms |
| コード長 | 483 bytes |
| 記録 | |
| コンパイル時間 | 2,245 ms |
| コンパイル使用メモリ | 193,660 KB |
| 最終ジャッジ日時 | 2025-01-07 12:31:32 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 35 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:34: warning: integer overflow in expression of type ‘int’ results in ‘2147483647’ [-Woverflow]
23 | cout<<c[31][x]<<' '<<((1<<31)-1)*c[30][x-1]<<endl;
| ~~~~~~~^~
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll c[32][32];
for (int i=0;i<=31;i++) {
c[i][0]=c[i][i]=1;
}
for (int i=2;i<=31;i++)
for (int j=1;j<i;j++)
c[i][j]=c[i-1][j-1]+c[i-1][j];
int x;
cin>>x;
if (x>31) {
cout<<"0 0\n";
return 0;
}
if (x==0) {
cout<<"1 0\n";
return 0;
}
cout<<c[31][x]<<' '<<((1<<31)-1)*c[30][x-1]<<endl;
return 0;
}