結果
問題 | No.420 mod2漸化式 |
ユーザー |
![]() |
提出日時 | 2016-09-22 13:44:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 641 bytes |
コンパイル時間 | 2,096 ms |
コンパイル使用メモリ | 166,536 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 13:03:49 |
合計ジャッジ時間 | 2,948 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 35 |
ソースコード
#include <bits/stdc++.h>using namespace std;const int mod = 1000000007;int x, fact[109], inv[109], factinv[109];int main() {fact[0] = 1;for(int i = 1; i <= 100; i++) fact[i] = 1LL * fact[i - 1] * i % mod;inv[1] = 1;for(int i = 2; i <= 100; i++) inv[i] = 1LL * inv[mod % i] * (mod - mod / i) % mod;factinv[0] = 1;for(int i = 1; i <= 100; i++) factinv[i] = 1LL * factinv[i - 1] * inv[i] % mod;cin >> x;if(x >= 32) {cout << 0 << ' ' << 0 << endl;}else {int res = 1LL * fact[31] * factinv[x] % mod * factinv[31 - x] % mod;long long ret = 1LL * res * x / 31 * 2147483647;cout << res << ' ' << ret << endl;}}