結果
問題 | No.220 世界のなんとか2 |
ユーザー |
![]() |
提出日時 | 2017-06-22 00:41:33 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 556 bytes |
コンパイル時間 | 3,150 ms |
コンパイル使用メモリ | 66,668 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 01:28:03 |
合計ジャッジ時間 | 3,944 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 39) Warning: Use the new 'sugar' module instead; future is deprecated [Deprecated] /home/judge/data/code/Main.nim(1, 39) Warning: imported and not used: 'future' [UnusedImport] /home/judge/data/code/Main.nim(1, 28) Warning: imported and not used: 'algorithm' [UnusedImport]
ソースコード
import strutils, sequtils, algorithm, future {.warning[SmallLshouldNotBeUsed]: off.} when isMainModule: var n = stdin.readLine.parseInt dp = newSeqWith(n+1, newSeqWith(3, newSeq[int](2))) dp[0][0][0] = 1 for i in 0..<n: for j in 0..2: for k in 0..1: for l in 0..9: if l == 3: dp[i+1][l mod 3][1] += dp[i][j][k] else: dp[i+1][l mod 3][k] += dp[i][j][k] var ans = 0 for j in 0..2: for k in 0..1: if j == 0 or k == 1: ans += dp[n][j][k] echo ans - 1