結果

問題 No.164 ちっちゃくないよ!!
ユーザー htensaihtensai
提出日時 2019-11-27 11:38:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 170 ms / 2,000 ms
コード長 683 bytes
コンパイル時間 2,385 ms
コンパイル使用メモリ 74,876 KB
実行使用メモリ 42,128 KB
最終ジャッジ日時 2024-04-25 11:50:21
合計ジャッジ時間 4,260 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
40,756 KB
testcase_01 AC 116 ms
41,148 KB
testcase_02 AC 115 ms
41,196 KB
testcase_03 AC 111 ms
41,004 KB
testcase_04 AC 120 ms
41,324 KB
testcase_05 AC 161 ms
42,104 KB
testcase_06 AC 170 ms
42,128 KB
testcase_07 AC 159 ms
41,360 KB
testcase_08 AC 151 ms
41,668 KB
testcase_09 AC 167 ms
41,920 KB
testcase_10 AC 129 ms
41,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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++) {
		    char[] arr = sc.next().toCharArray();
		    int max = 0;
		    for (char c : arr) {
		        max = Math.max(max, charToInt(c));
		    }
		    max++;
		    long value = 0;
		    for (char c : arr) {
		        value *= max;
		        value += charToInt(c);
		    }
		    min = Math.min(min, value);
		}
		System.out.println(min);
	}
	
	static int charToInt(char c) {
	    if (c <= '9') {
	        return c - '0';
	    } else {
	        return c - 'A' + 10;
	    }
	}
}
0