結果
問題 | No.164 ちっちゃくないよ!! |
ユーザー | kohaku_kohaku |
提出日時 | 2016-11-28 16:52:34 |
言語 | Java19 (openjdk 21) |
結果 |
AC
|
実行時間 | 172 ms / 2,000 ms |
コード長 | 935 bytes |
コンパイル時間 | 2,326 ms |
コンパイル使用メモリ | 77,396 KB |
実行使用メモリ | 56,588 KB |
最終ジャッジ日時 | 2023-08-18 08:49:34 |
合計ジャッジ時間 | 4,324 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 120 ms
55,576 KB |
testcase_01 | AC | 119 ms
56,588 KB |
testcase_02 | AC | 114 ms
55,356 KB |
testcase_03 | AC | 116 ms
55,360 KB |
testcase_04 | AC | 118 ms
55,584 KB |
testcase_05 | AC | 172 ms
56,476 KB |
testcase_06 | AC | 171 ms
56,248 KB |
testcase_07 | AC | 165 ms
55,856 KB |
testcase_08 | AC | 172 ms
55,716 KB |
testcase_09 | AC | 170 ms
56,176 KB |
testcase_10 | AC | 125 ms
55,348 KB |
ソースコード
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++){ String S = sc.next(); int L=S.length(); int [] u = new int [L]; int max=0; for(int j=0; j<L; j++){ u[j] = S.charAt(j); if(u[j]>='0' && u[j]<='9'){ u[j]-='0'; }else{ u[j]=u[j]-'A'+10; } max=Math.max(max,u[j]); } long num=0; for(int j=0; j<L; j++){ long t=1; for(int k=j; k<L-1; k++){ t*=(max+1); } num+=t*u[j]; } min=Math.min(min,num); } System.out.println(min); } }