結果

問題 No.164 ちっちゃくないよ!!
ユーザー YamaKasa
提出日時 2018-07-25 00:36:42
言語 Java
(openjdk 23)
結果
AC  
実行時間 214 ms / 2,000 ms
コード長 901 bytes
コンパイル時間 2,253 ms
コンパイル使用メモリ 77,340 KB
実行使用メモリ 55,056 KB
最終ジャッジ日時 2024-06-23 23:39:44
合計ジャッジ時間 4,825 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		String[] V = new String[N];
		for(int i = 0; i < N; i++) {
			V[i] = scan.next();
		}
		scan.close();

		// 'A' = 65, '1' = 49
		long min = Long.MAX_VALUE;
		for(int i = 0; i < N; i++) {
			String s = V[i];
			int max = 0;
			for(int j = 0; j < s.length(); j++) {
				char c = s.charAt(j);
				if(max < (int)c) {
					max = (int)c;
				}
				//System.out.println((int)c);
			}
			if(max <= 58) {
				max = 1 + max - 48;
			}else {
				max = 10 + max - 64;
				//System.out.println(max);
			}
			//System.out.println(max);
			for(int j = max; j <= 36; j++) {
				long num = Long.parseLong(Long.toString(Long.parseLong(s, j), 10));
				//System.out.println(num);
				if(min > num) {
					min = num;
				}
			}
		}
		System.out.println(min);
	}
}
0