結果

問題 No.164 ちっちゃくないよ!!
ユーザー 6soukiti29
提出日時 2017-10-09 08:41:57
言語 Nim
(2.2.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 519 bytes
コンパイル時間 3,013 ms
コンパイル使用メモリ 65,716 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 03:16:24
合計ジャッジ時間 3,749 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]
/home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'math' [UnusedImport]

ソースコード

diff #

import sequtils,strutils,math
var
    N = stdin.readline.parseInt
    ANS : int64 = 5_000_000_000_000_000_000
    s : string
    
    
proc todigit(c : char): int =
    
    if c.isDigit:
        return c.ord - '0'.ord
    else:
        return c.ord - 'A'.ord + 10
        

for n in 1..N:
    s = stdin.readline
    var
        Mnum : int
        ans : int64
    
    for c in s:
        Mnum = max(Mnum, c.todigit)
    
    for c in s:
        ans *= Mnum + 1
        ans += c.todigit
    ANS = min(ANS, ans)
echo ANS
0