結果
| 問題 | No.420 mod2漸化式 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-05-07 11:51:19 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 505 bytes |
| コンパイル時間 | 513 ms |
| コンパイル使用メモリ | 65,548 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-14 14:37:49 |
| 合計ジャッジ時間 | 1,620 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 35 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:25:58: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
25 | cout << comb[31][x] << " " << ((1 << 31) - 1)*comb[30][x - 1] << endl;
| ~~~~~~~~~~^~~
ソースコード
#include<iostream>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)
#define ll long long
ll comb[32][32];
void create_comb() {
REP(i, 0, 32) {
REP(j, 0, 32) {
if (i == j || j == 0) comb[i][j] = 1;
else if (i < j) break;
else comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
}
}
}
int main()
{
int x;
cin >> x;
if (x > 31) cout << 0 << " " << 0 << endl;
else {
create_comb();
cout << comb[31][x] << " " << ((1 << 31) - 1)*comb[30][x - 1] << endl;
}
return 0;
}