結果

問題 No.164 ちっちゃくないよ!!
ユーザー nbisconbisco
提出日時 2017-02-04 15:06:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 10,880 KB
実行使用メモリ 7,944 KB
最終ジャッジ日時 2023-08-25 20:11:05
合計ジャッジ時間 1,501 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,944 KB
testcase_01 AC 15 ms
7,804 KB
testcase_02 AC 16 ms
7,944 KB
testcase_03 AC 15 ms
7,748 KB
testcase_04 AC 16 ms
7,824 KB
testcase_05 AC 22 ms
7,912 KB
testcase_06 AC 24 ms
7,796 KB
testcase_07 AC 19 ms
7,796 KB
testcase_08 AC 21 ms
7,868 KB
testcase_09 AC 20 ms
7,864 KB
testcase_10 AC 16 ms
7,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def convert(_s, base):
    ans = 0
    _s.reverse()
    for i, s in enumerate(_s):
        if s.isalpha():
            ans += base**i * (ord(s) - ord("A") + 10)
        else:
            ans += base**i * int(s)
    return ans

N = int(input())
nums = [input() for i in range(N)]

ans = 36**13
for i in nums:
    largest_char = sorted(i, reverse=True)[0]
    base = 10
    if largest_char.isalpha():
        base = ord(largest_char) - ord("A") + 11
    else:
        base = int(largest_char) + 1
    ans = min(ans, convert(list(i), base))
print(ans)
0