結果
| 問題 | No.314 ケンケンパ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-07 02:09:18 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 823 bytes |
| 記録 | |
| コンパイル時間 | 237 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 25,984 KB |
| 最終ジャッジ日時 | 2024-09-14 17:52:52 |
| 合計ジャッジ時間 | 4,619 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 16 |
コンパイルメッセージ
Syntax OK
ソースコード
#! ruby
# yukicoder My Practice
# author: Leonardone @ NEETSDKASU
# last
# ケン
# ケンケン
# ケンパ
# ケンケンパ
# interval
# ケンパ
# ケンケンパ
# n = 1
# ケン
# n = 2
# ケンケン
# ケンパ
# n = 3
# ケンパケン
# ケンケンパ
# n = 4
# ケンパケンパ
# ケンパケンケン
# ケンケンパケン
n = gets.to_i
MD = (10 ** 9) + 7
def cmb(n, c)
r = 1
c = [c, n - c].min
c.times do |i|
r *= n - i
r /= (i + 1)
end
r % MD
end
def fnc(n)
c = 0
i = 0
if n > 0 && n.odd?
i = 1
n -= 3
end
while n >= 0 do
d, m = n.divmod 2
if m == 0
c = (c + cmb(d + i, i)) % MD
end
i += 2
n -= 6
end
c
end
c = fnc(n) + fnc(n - 1) + fnc(n - 2)
puts (c % MD)