結果
問題 | No.112 ややこしい鶴亀算 |
ユーザー | koukonko |
提出日時 | 2015-12-11 18:41:27 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 91 ms / 5,000 ms |
コード長 | 1,016 bytes |
コンパイル時間 | 2,447 ms |
コンパイル使用メモリ | 78,836 KB |
実行使用メモリ | 52,868 KB |
最終ジャッジ日時 | 2023-10-13 11:14:56 |
合計ジャッジ時間 | 5,580 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 81 ms
52,552 KB |
testcase_01 | AC | 80 ms
52,244 KB |
testcase_02 | AC | 90 ms
52,480 KB |
testcase_03 | AC | 89 ms
52,304 KB |
testcase_04 | AC | 81 ms
52,680 KB |
testcase_05 | AC | 77 ms
52,808 KB |
testcase_06 | AC | 78 ms
52,404 KB |
testcase_07 | AC | 91 ms
52,780 KB |
testcase_08 | AC | 81 ms
52,292 KB |
testcase_09 | AC | 90 ms
52,120 KB |
testcase_10 | AC | 81 ms
52,228 KB |
testcase_11 | AC | 89 ms
52,304 KB |
testcase_12 | AC | 90 ms
52,804 KB |
testcase_13 | AC | 79 ms
52,248 KB |
testcase_14 | AC | 79 ms
52,240 KB |
testcase_15 | AC | 76 ms
50,828 KB |
testcase_16 | AC | 80 ms
52,364 KB |
testcase_17 | AC | 77 ms
50,656 KB |
testcase_18 | AC | 79 ms
52,808 KB |
testcase_19 | AC | 76 ms
52,188 KB |
testcase_20 | AC | 78 ms
52,640 KB |
testcase_21 | AC | 75 ms
50,716 KB |
testcase_22 | AC | 78 ms
52,868 KB |
testcase_23 | AC | 76 ms
51,076 KB |
testcase_24 | AC | 76 ms
50,524 KB |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { BufferedReader buff = new BufferedReader(new InputStreamReader(System.in)); try { int count = Integer.parseInt(buff.readLine()); String[] box = buff.readLine().split(" "); int[] num = new int[count]; int max = 0; for (int i = 0; i < count; ++i) { num[i] = Integer.parseInt(box[i]); if (max < num[i]) { max = num[i]; } } int check = 0; boolean flag = true; for (int i = 0; i < count; ++i) { if (max == num[i]) { check++; } else { flag = false; } } if (flag && count * 2 - 2 != max) { System.out.println((count - check) + " " + check); } else { System.out.println(check + " " + (count - check)); } } catch (NumberFormatException e) { e.getStackTrace(); } catch (IOException e) { e.getStackTrace(); } catch (Exception e) { e.getStackTrace(); } } }