結果
問題 |
No.420 mod2漸化式
|
ユーザー |
![]() |
提出日時 | 2016-09-09 23:59:16 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 646 bytes |
コンパイル時間 | 165 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-11-16 18:48:43 |
合計ジャッジ時間 | 2,142 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 19 WA * 16 |
ソースコード
#code def combi(n, k): x = n r = 1 for i in range(1, min(31 - k, k) + 1): r *= x r //= i x -= 1 return r x = int(input()) if x == 0: print(1, 0) elif x >= 31: print(0, 0) elif x <= 31 - x: ans_count = combi(31, x) ans_sum = 0 multi = combi(30, x - 1) for i in range(31): t = 1 << i ans_sum += t * multi print(ans_count, ans_sum) else: x = 31 - x ans_count = combi(31, x) ans_sum = (1 << 31 - 2) * (1 << 31 - 1) // 2 multi = combi(30, x - 1) for i in range(31): t = 1 << i ans_sum -= t * multi print(ans_count, ans_sum)