結果

問題 No.164 ちっちゃくないよ!!
ユーザー lloyz
提出日時 2023-06-08 21:25:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 716 bytes
コンパイル時間 1,102 ms
コンパイル使用メモリ 82,596 KB
実行使用メモリ 73,160 KB
最終ジャッジ日時 2024-12-31 05:47:21
合計ジャッジ時間 1,936 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
L = [list(input()) for _ in range(n)]

ans = 10**18
for i in range(n):
    res = 0
    m = len(L[i])
    max_ = '0'
    for j in range(m):
        if L[i][j].isdigit():
            if max_.isdigit():
                max_ = max(max_, L[i][j])
        else:
            if max_.isdigit():
                max_ = L[i][j]
            else:
                max_ = max(max_, L[i][j])
    if max_.isdigit():
        d = int(max_) + 1
    else:
        d = ord(max_) - ord('A') + 11
    for j in range(m):
        if L[i][j].isdigit():
            res += pow(d, m - j - 1) * int(L[i][j])
        else:
            res += pow(d, m - j - 1) * (ord(L[i][j]) - ord('A') + 10)
    ans = min(ans, res)
print(ans)
0