結果
| 問題 |
No.167 N^M mod 10
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-18 19:30:52 |
| 言語 | Nim (2.2.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,079 bytes |
| コンパイル時間 | 2,223 ms |
| コンパイル使用メモリ | 61,200 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-01 10:19:11 |
| 合計ジャッジ時間 | 3,320 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 26 RE * 1 |
ソースコード
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': break
else: result = 10 * result + k.ord - '0'.ord
proc scanN(): int =
var pre : char
while true:
var k = getchar_unlocked()
if k < '0' : break
pre = k
return pre.ord - '0'.ord
let n = scanN()
if n in [0,1,5,6]:
if getchar_unlocked() == '0': echo 1
else: echo n
quit 0
var c = getchar_unlocked()
if c == '0': quit "1", 0
if n in [4,9]:
while true:
let k = getchar_unlocked()
if k < '0' :
let last = (c.ord - '0'.ord) mod 2
if n == 4: echo [6,4][last]
elif n == 9: echo [1,9][last]
quit 0
c = k
else:
var d : char
while true:
let k = getchar_unlocked()
if k < '0' :
let last = ((d.ord - '0'.ord) * 10 + (c.ord - '0'.ord)) mod 4
if 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 0
d = c
c = k