結果
| 問題 |
No.420 mod2漸化式
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-20 23:53:02 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 224 bytes |
| コンパイル時間 | 263 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 29,568 KB |
| 最終ジャッジ日時 | 2024-11-23 15:58:17 |
| 合計ジャッジ時間 | 37,899 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 18 TLE * 17 |
コンパイルメッセージ
Syntax OK
ソースコード
x = gets.to_i
if 0 == x
puts '1 0'
exit 0
end
if 31 < x
puts '0 0'
exit 0
end
def c(n, k)
return 1 if 0 == k % n
c(n-1, k) + c(n-1, k-1)
end
cnt = c(31, x)
sum = (2**31 - 1) * c(30, x-1)
puts "#{cnt} #{sum}"