結果
問題 |
No.164 ちっちゃくないよ!!
|
ユーザー |
|
提出日時 | 2023-06-08 21:26:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 74 ms / 2,000 ms |
コード長 | 717 bytes |
コンパイル時間 | 387 ms |
コンパイル使用メモリ | 82,224 KB |
実行使用メモリ | 73,608 KB |
最終ジャッジ日時 | 2024-12-31 05:47:44 |
合計ジャッジ時間 | 1,556 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
n = int(input()) L = [list(input()) for _ in range(n)] ans = 1 << 63 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)