結果

問題 No.164 ちっちゃくないよ!!
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-22 07:37:07
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,027 bytes
コンパイル時間 3,383 ms
コンパイル使用メモリ 74,632 KB
実行使用メモリ 58,604 KB
最終ジャッジ日時 2023-08-04 16:22:15
合計ジャッジ時間 5,830 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
55,744 KB
testcase_01 AC 114 ms
56,252 KB
testcase_02 AC 107 ms
56,228 KB
testcase_03 AC 105 ms
55,952 KB
testcase_04 AC 113 ms
56,292 KB
testcase_05 AC 170 ms
58,536 KB
testcase_06 AC 168 ms
56,884 KB
testcase_07 AC 159 ms
56,644 KB
testcase_08 AC 157 ms
58,604 KB
testcase_09 AC 167 ms
58,496 KB
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise110{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    String[] v = new String[n];

    for(int i = 0; i < n; i++){
      v[i] = sc.next();
    }

    long decimal = Long.MAX_VALUE;
    for(int i = 0; i < v.length; i++){
      char[] num = v[i].toCharArray();
      int al = 0;
      for(int j = 0; j < num.length; j++){
        al = Math.max(changeToInt(num[j]) + 1, al);
      }
      long d = 0;
      for(int j = 0; j < num.length; j++){
        d += changeToInt(num[num.length - 1 - j]) * (long)Math.pow(al, j);
      }
      decimal = Math.min(decimal, d);
    }
    System.out.println(decimal);
  }
  private static int changeToInt(char a){
    char[] alphabet = new char[26];
    for(int i = 0; i < alphabet.length; i++){
      alphabet[i] = (char)(i + 65);
    }
    if(Character.isDigit(a)){
      return Character.getNumericValue(a);
    }else{
      return Arrays.binarySearch(alphabet, a) + 10;
    }
  }
}
0