結果
問題 |
No.420 mod2漸化式
|
ユーザー |
![]() |
提出日時 | 2019-05-09 19:35:37 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 480 bytes |
コンパイル時間 | 119 ms |
コンパイル使用メモリ | 28,288 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-02 00:50:47 |
合計ジャッジ時間 | 1,795 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 31 WA * 1 RE * 3 |
ソースコード
// yukicoder: No.420 mod2漸化式 // 2019.5.9 bal4u #include <stdio.h> long long tbl[35][35]; long long combi(int n, int k) { long long ans; if (tbl[n][k]) return tbl[n][k]; if ((k << 1) > n) k = n-k; if (k == 0) ans = 1; else if (k == 1) ans = n; else ans = combi(n-1, k) + combi(n-1, k-1); return tbl[n][k] = ans; } int main() { int x; scanf("%d", &x); if (x == 0) puts("0 0"); else printf("%lld %lld\n", combi(31, x), 2147483647LL*combi(30, x-1)); return 0; }