結果

問題 No.164 ちっちゃくないよ!!
ユーザー yuppe19 😺yuppe19 😺
提出日時 2020-01-18 11:09:32
言語 Python2
(2.7.18)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 706 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 6,780 KB
実行使用メモリ 6,084 KB
最終ジャッジ日時 2023-09-09 10:55:33
合計ジャッジ時間 1,093 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
6,056 KB
testcase_01 AC 12 ms
5,980 KB
testcase_02 AC 12 ms
6,040 KB
testcase_03 AC 12 ms
6,084 KB
testcase_04 AC 12 ms
6,056 KB
testcase_05 AC 20 ms
5,948 KB
testcase_06 AC 20 ms
6,056 KB
testcase_07 AC 15 ms
6,008 KB
testcase_08 AC 18 ms
6,056 KB
testcase_09 AC 18 ms
5,976 KB
testcase_10 AC 13 ms
6,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python2
# -*- coding: utf-8 -*-
# †
import string

# 基数変換. {base}進数で表現された{s}を10進数にします。
#base2int = lambda s, base: int(s, base)
def base2int(s, base, digits=string.digits+string.ascii_uppercase):
    if len(s) == 0:
        return 0
    is_negative = s[0] == '-'
    if is_negative:
        s = s[1:]
    num = 0
    for c in s:
        num *= base
        num += digits.index(c)
    if is_negative:
        num *= -1
    return num


D = string.digits + string.ascii_uppercase
n = int(raw_input())
mini = float('inf')
for _ in xrange(n):
    s = raw_input()
    base = max(D.find(ch) + 1 for ch in s)
    mini = min(mini, base2int(s, base))
print mini
0