結果
問題 |
No.164 ちっちゃくないよ!!
|
ユーザー |
![]() |
提出日時 | 2020-10-14 11:56:12 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 190 ms / 2,000 ms |
コード長 | 815 bytes |
コンパイル時間 | 2,406 ms |
コンパイル使用メモリ | 74,624 KB |
実行使用メモリ | 42,124 KB |
最終ジャッジ日時 | 2024-07-20 19:03:09 |
合計ジャッジ時間 | 5,138 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long min = Long.MAX_VALUE; for (int i = 0; i < n; i++) { min = Math.min(min, getValue(sc.next().toCharArray())); } System.out.print(min); } static long getValue(char[] arr) { char max = '0'; for (char c : arr) { max = (char)Math.max(max, c); } int idxed = 0; if (max >= 'A') { idxed = 10 + max - 'A'; } else { idxed = max - '0'; } idxed++; long value = 0; for (char c : arr) { value *= idxed; if (c >= 'A') { value += 10 + c - 'A'; } else { value += c - '0'; } } return value; } }