結果

問題 No.164 ちっちゃくないよ!!
ユーザー spaciaspacia
提出日時 2016-01-06 23:04:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 871 bytes
コンパイル時間 4,758 ms
コンパイル使用メモリ 77,212 KB
実行使用メモリ 37,932 KB
最終ジャッジ日時 2024-04-22 14:20:14
合計ジャッジ時間 6,141 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
36,956 KB
testcase_01 AC 45 ms
36,964 KB
testcase_02 AC 46 ms
36,820 KB
testcase_03 AC 46 ms
36,808 KB
testcase_04 AC 44 ms
36,820 KB
testcase_05 AC 76 ms
37,932 KB
testcase_06 AC 73 ms
37,588 KB
testcase_07 AC 52 ms
37,024 KB
testcase_08 AC 59 ms
37,196 KB
testcase_09 AC 59 ms
37,364 KB
testcase_10 AC 47 ms
36,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static long getDecimal (String v) {
		long ret = 0;
		String s = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		
		int max = 0;
		for (int i = 0; i < v.length(); i++) {
			max = Math.max(max , (int)v.charAt(i));
		}
		
		long k = 1 , d = s.indexOf((char)max) + 1;
		
		//out(d);
		
		for (int i = v.length() - 1; i >= 0; i--) {
			ret += s.indexOf(v.charAt(i)) * k;
			k *= d;
		}
		
		return ret;
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		long ans = Long.MAX_VALUE;
		
		for (int i = 0; i < n; i++) {
			String v = br.readLine();
			ans = Math.min(ans , getDecimal(v));
		}
		
		out(ans);
	}
}
0