結果
問題 |
No.164 ちっちゃくないよ!!
|
ユーザー |
|
提出日時 | 2019-01-19 21:21:06 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 751 bytes |
コンパイル時間 | 2,691 ms |
コンパイル使用メモリ | 62,340 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-01 10:23:30 |
合計ジャッジ時間 | 3,381 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
import sequtils template times*(n:int,body) = (for _ in 0..<n: body) template `min=`*(x,y) = x = min(x,y) 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 result = 10 * result + k.ord - '0'.ord proc scanAscii(S:seq[int],rank:int) : tuple[n:int,ok:bool]= var n = 0 for s in S: if s >= rank : return (-1,false) n = n * rank + s return (n,true) let n = scan() var ans = int.high n.times: let S = toSeq(stdin.readLine().items).mapIt: if '0' <= it and it <= '9' : it.ord - '0'.ord else: it.ord - 'A'.ord + 10 for rank in 2..36: let (n,ok) = S.scanAscii(rank) if ok : ans .min= n echo ans