結果

問題 No.164 ちっちゃくないよ!!
ユーザー lloyzlloyz
提出日時 2023-06-08 21:25:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 716 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 78,056 KB
最終ジャッジ日時 2023-08-30 01:22:16
合計ジャッジ時間 2,275 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,308 KB
testcase_01 AC 69 ms
71,368 KB
testcase_02 AC 69 ms
71,420 KB
testcase_03 AC 70 ms
71,644 KB
testcase_04 AC 70 ms
71,432 KB
testcase_05 WA -
testcase_06 AC 106 ms
78,056 KB
testcase_07 AC 91 ms
76,668 KB
testcase_08 AC 101 ms
76,764 KB
testcase_09 AC 102 ms
77,104 KB
testcase_10 AC 71 ms
71,496 KB
権限があれば一括ダウンロードができます

ソースコード

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