結果
問題 | No.164 ちっちゃくないよ!! |
ユーザー | kenkoooo |
提出日時 | 2015-03-12 23:56:49 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 163 ms / 2,000 ms |
コード長 | 993 bytes |
コンパイル時間 | 1,822 ms |
コンパイル使用メモリ | 77,788 KB |
実行使用メモリ | 42,084 KB |
最終ジャッジ日時 | 2024-04-21 15:20:23 |
合計ジャッジ時間 | 3,857 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 115 ms
41,084 KB |
testcase_01 | AC | 107 ms
41,416 KB |
testcase_02 | AC | 112 ms
41,144 KB |
testcase_03 | AC | 117 ms
41,748 KB |
testcase_04 | AC | 113 ms
41,488 KB |
testcase_05 | AC | 158 ms
42,084 KB |
testcase_06 | AC | 163 ms
42,068 KB |
testcase_07 | AC | 148 ms
41,748 KB |
testcase_08 | AC | 153 ms
42,056 KB |
testcase_09 | AC | 158 ms
41,968 KB |
testcase_10 | AC | 113 ms
41,744 KB |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long min = Long.MAX_VALUE; int[] shinsu = new int[91]; for (int i = 0; i < shinsu.length; i++) { if (i <= 57) { shinsu[i] = i - 47; } else { shinsu[i] = i - 54; } } for (int n = 0; n < N; n++) { int max = 0; char[] input = sc.next().toCharArray(); /* * char の 0~9はintの48~57 A~Zは65~90 */ for (int i = 0; i < input.length; i++) { max = Math.max(max, (int) input[i]); } int shinho = shinsu[max]; long ans = 0; long now = 1; for (int i = 0; i < input.length; i++) { char c = input[input.length - 1 - i]; int conv = convert(c); ans += conv * now; now *= shinho; } min = Math.min(min, ans); } System.out.println(min); } static int convert(char c) { int n = (int) c; if (n <= 57) { n -= 48; } else { n -= 55; } return n; } }