結果

問題 No.164 ちっちゃくないよ!!
コンテスト
ユーザー むらため
提出日時 2019-01-19 21:21:06
言語 Nim
(2.2.8)
コンパイル:
nim --nimcache=~ --hints:off -o:a.out -d:release cpp _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 751 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,970 ms
コンパイル使用メモリ 70,456 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2026-03-22 08:52:02
合計ジャッジ時間 2,665 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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