結果

問題 No.164 ちっちゃくないよ!!
ユーザー むらためむらため
提出日時 2019-01-19 21:21:06
言語 Nim
(2.0.2)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 751 bytes
コンパイル時間 2,181 ms
コンパイル使用メモリ 70,644 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 02:20:17
合計ジャッジ時間 2,888 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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
0