結果

問題 No.164 ちっちゃくないよ!!
ユーザー aka_satana_haaka_satana_ha
提出日時 2017-12-07 09:57:05
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 722 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 7,944 KB
最終ジャッジ日時 2023-08-19 12:03:00
合計ジャッジ時間 1,149 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,840 KB
testcase_01 AC 16 ms
7,836 KB
testcase_02 AC 16 ms
7,908 KB
testcase_03 AC 15 ms
7,820 KB
testcase_04 AC 16 ms
7,944 KB
testcase_05 AC 41 ms
7,776 KB
testcase_06 AC 35 ms
7,816 KB
testcase_07 AC 24 ms
7,732 KB
testcase_08 AC 28 ms
7,784 KB
testcase_09 AC 29 ms
7,804 KB
testcase_10 AC 16 ms
7,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())

tmp_min=float("inf")
for i in range(N):
    v=input().strip()
    #進数の決定
    base=0
    for j in range(len(v)):
        tmp_base=0
        #数字
        if ord(v[j])<=ord('9'):
            tmp_base=ord(v[j])-ord('0')
        #英大文字
        else:
            tmp_base=10+ord(v[j])-ord('A')
        if tmp_base>base:
            base=tmp_base
    base+=1
    #10進数での値の算出
    tmp=0
    mul=1
    for j in reversed(range(len(v))):
        #数字
        if ord(v[j])<=ord('9'):
            tmp+=mul*(ord(v[j])-ord('0'))
        #英大文字
        else:
            tmp+=mul*(10+ord(v[j])-ord('A'))
        mul*=base
    if tmp_min>tmp:
        tmp_min=tmp
print(tmp_min)
0