結果

問題 No.220 世界のなんとか2
ユーザー t8m8⛄️t8m8⛄️
提出日時 2017-06-22 00:41:33
言語 Nim
(2.0.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 556 bytes
コンパイル時間 2,986 ms
コンパイル使用メモリ 68,152 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 13:08:04
合計ジャッジ時間 4,177 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/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]

ソースコード

diff #

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
0