結果
問題 | No.167 N^M mod 10 |
ユーザー |
|
提出日時 | 2019-01-18 19:31:49 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,078 bytes |
コンパイル時間 | 2,578 ms |
コンパイル使用メモリ | 61,440 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-22 01:50:22 |
合計ジャッジ時間 | 3,398 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
ソースコード
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}proc scan(): int =while true:var k = getchar_unlocked()if k < '0' or k > '9': breakelse: result = 10 * result + k.ord - '0'.ordproc scanN(): int =var pre : charwhile true:var k = getchar_unlocked()if k < '0' : breakpre = kreturn pre.ord - '0'.ordlet n = scanN()if n in [0,1,5,6]:if getchar_unlocked() == '0': echo 1else: echo nquit 0var c = getchar_unlocked()if c == '0': quit "1", 0if n in [4,9]:while true:let k = getchar_unlocked()if k < '0' :let last = (c.ord - '0'.ord) mod 2if n == 4: echo [6,4][last]elif n == 9: echo [1,9][last]quit 0c = kelse:var d = '0'while true:let k = getchar_unlocked()if k < '0' :let last = ((d.ord - '0'.ord) * 10 + (c.ord - '0'.ord)) mod 4if n == 2: echo [6,2,4,8][last]elif n == 3: echo [1,3,9,7][last]elif n == 7: echo [1,7,9,3][last]elif n == 8: echo [6,8,4,2][last]quit 0d = cc = k