結果

問題 No.533 Mysterious Stairs
ユーザー 6soukiti296soukiti29
提出日時 2017-06-23 23:07:13
言語 Nim
(2.0.0)
結果
AC  
実行時間 56 ms / 5,000 ms
コード長 663 bytes
コンパイル時間 3,122 ms
コンパイル使用メモリ 67,872 KB
実行使用メモリ 68,784 KB
最終ジャッジ日時 2023-09-12 13:10:49
合計ジャッジ時間 5,213 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 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 2 ms
4,376 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 11 ms
12,016 KB
testcase_21 AC 11 ms
11,840 KB
testcase_22 AC 26 ms
24,956 KB
testcase_23 AC 56 ms
68,784 KB
testcase_24 AC 56 ms
68,780 KB
testcase_25 AC 10 ms
11,888 KB
testcase_26 AC 54 ms
68,736 KB
testcase_27 AC 20 ms
24,848 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import sequtils,strutils
type
    jump = tuple[one : int, two : int, three : int]
const m = 1_000_000_007
var
    N,i,j : int
    procedure : seq[jump]
    pattern : jump 
procedure = @[(0,0,0),(1,0,0),(0,1,0),(1,1,1)]
N = stdin.readline.parseInt
if N < 3:
    echo 1
elif N == 3:
    echo 3
else:
    for i in 4..N:
        pattern.one = (procedure[i - 1].two + procedure[i - 1].three) mod m
        pattern.two = (procedure[i - 2].one + procedure[i - 2].three) mod m
        pattern.three = (procedure[i - 3].one + procedure[i - 3].two) mod m
        procedure.add(pattern)
    j = (procedure[N].one + procedure[N].two + procedure[N].three).int mod m
    echo j
0