結果

問題 No.164 ちっちゃくないよ!!
ユーザー GrenacheGrenache
提出日時 2016-02-14 17:40:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 874 bytes
コンパイル時間 3,450 ms
コンパイル使用メモリ 75,212 KB
実行使用メモリ 41,868 KB
最終ジャッジ日時 2024-04-22 14:22:14
合計ジャッジ時間 5,763 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
41,032 KB
testcase_01 AC 107 ms
39,936 KB
testcase_02 AC 105 ms
40,460 KB
testcase_03 AC 116 ms
41,216 KB
testcase_04 AC 112 ms
40,536 KB
testcase_05 AC 158 ms
41,868 KB
testcase_06 AC 166 ms
41,796 KB
testcase_07 AC 134 ms
41,452 KB
testcase_08 AC 164 ms
41,796 KB
testcase_09 AC 156 ms
41,700 KB
testcase_10 AC 121 ms
41,312 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