結果
| 問題 | No.287 場合の数 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-31 22:44:17 |
| 言語 | Crystal (1.14.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 5,000 ms |
| コード長 | 209 bytes |
| 記録 | |
| コンパイル時間 | 12,081 ms |
| コンパイル使用メモリ | 295,652 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 19:22:51 |
| 合計ジャッジ時間 | 12,530 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
Memo={} of Tuple(Int32,Int32) => Int64
def perform(n,d,u)
if d==1
0<=n&&n<=u ? 1 : 0
else
Memo[{n,d}]||=(0..u).reduce(0_i64){|s,i|s+perform(n-i,d-1,u)}
end
end
n=gets.not_nil!.to_i
puts perform(6*n,8,n)