結果
問題 |
No.747 循環小数N桁目 Hard
|
ユーザー |
|
提出日時 | 2019-01-25 19:24:33 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 562 bytes |
コンパイル時間 | 2,296 ms |
コンパイル使用メモリ | 61,680 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 10:47:47 |
合計ジャッジ時間 | 5,304 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 120 |
ソースコード
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .} proc scanMod6(): int = while true: let c = getchar_unlocked() if c < '0': return result = (result * 10 + c.ord - '0'.ord) mod 6 proc scanIsMod2():bool = var k : char while true: let c = getchar_unlocked() if c < '0': return (k.ord - '0'.ord) mod 2 == 0 k = c const resStr = "428571" let n = scanMod6() if n in [0,1,3,4] : echo resStr[n] else: let m = scanIsMod2() if n == 5: echo resStr[if m : 1 else: 5] else: echo resStr[if m : 4 else : 2]