結果

問題 No.164 ちっちゃくないよ!!
ユーザー GrenacheGrenache
提出日時 2016-02-14 17:40:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 874 bytes
コンパイル時間 3,484 ms
コンパイル使用メモリ 74,872 KB
実行使用メモリ 42,108 KB
最終ジャッジ日時 2024-10-14 13:29:18
合計ジャッジ時間 6,050 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
40,860 KB
testcase_01 AC 116 ms
41,096 KB
testcase_02 AC 116 ms
41,112 KB
testcase_03 AC 116 ms
41,080 KB
testcase_04 AC 114 ms
40,960 KB
testcase_05 AC 160 ms
42,108 KB
testcase_06 AC 156 ms
41,752 KB
testcase_07 AC 161 ms
41,328 KB
testcase_08 AC 159 ms
41,864 KB
testcase_09 AC 161 ms
41,660 KB
testcase_10 AC 116 ms
41,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder164 {

    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++) {
        	char[] num = sc.next().toCharArray();

        	int base = 0;
        	for (char c : num) {
        		if (c >= '0' && c <= '9') {
        			base = Math.max(base, c - '0');
        		} else {
        			base = Math.max(base, c - 'A' + 10);
        		}
        	}
        	base += 1;

        	long tmp = 0;
        	for (char c : num) {
        		tmp *= base;

        		if (c >= '0' && c <= '9') {
        			tmp += c - '0';
        		} else {
        			tmp += c - 'A' + 10;
        		}
        	}

        	min = Math.min(min, tmp);
        }

        System.out.println(min);

        sc.close();
    }
}
0