結果
| 問題 |
No.420 mod2漸化式
|
| コンテスト | |
| ユーザー |
kyuna
|
| 提出日時 | 2019-07-21 02:14:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 725 bytes |
| コンパイル時間 | 853 ms |
| コンパイル使用メモリ | 75,032 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-31 15:30:30 |
| 合計ジャッジ時間 | 2,197 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 35 |
ソースコード
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
vector<vector<long long>> get_combination(int ma) {
vector<vector<long long>> mat(ma + 1, vector<long long>(ma + 1));
for (int n = 0; n <= ma; n++) mat[n][0] = 1;
for (int n = 1; n <= ma; n++) for (int r = 1; r <= n; r++) {
mat[n][r] = mat[n - 1][r - 1] + mat[n - 1][r];
}
return mat;
}
int main() {
int x; cin >> x;
if (x == 0) {
cout << "1 0" << endl;
return 0;
}
if (x > 31) {
cout << "0 0" << endl;
return 0;
}
vector<vector<long long>> comb = get_combination(31);
cout << comb[31][x] << " " << comb[30][x - 1] * ~-(1LL << 31) << endl;
return 0;
}
kyuna