結果
| 問題 |
No.420 mod2漸化式
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-14 17:47:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 1,000 ms |
| コード長 | 867 bytes |
| コンパイル時間 | 1,006 ms |
| コンパイル使用メモリ | 75,496 KB |
| 最終ジャッジ日時 | 2025-01-09 18:47:14 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 35 |
ソースコード
#include <iostream>
#include <vector>
template <class T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }
using lint = long long;
constexpr int N = 31;
void solve() {
auto comb = vec(N + 1, vec(N + 1, 0LL));
comb[0][0] = 1;
for (int x = 0; x < N; ++x) {
for (int y = 0; y <= x; ++y) {
comb[x + 1][y] += comb[x][y];
comb[x + 1][y + 1] += comb[x][y];
}
}
int x;
std::cin >> x;
if (x > N) {
std::cout << 0 << " " << 0 << std::endl;
return;
}
if (x == 0) {
std::cout << 1 << " " << 0 << std::endl;
return;
}
std::cout << comb[N][x] << " " << comb[N - 1][x - 1] * ((1LL << 31) - 1)
<< std::endl;
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}