結果

問題 No.112 ややこしい鶴亀算
ユーザー TatsuDXTatsuDX
提出日時 2016-09-08 23:47:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 5,000 ms
コード長 572 bytes
コンパイル時間 2,884 ms
コンパイル使用メモリ 76,224 KB
実行使用メモリ 55,104 KB
最終ジャッジ日時 2024-04-27 18:08:57
合計ジャッジ時間 6,931 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
54,488 KB
testcase_01 AC 121 ms
54,212 KB
testcase_02 AC 139 ms
54,472 KB
testcase_03 AC 122 ms
54,476 KB
testcase_04 AC 115 ms
53,048 KB
testcase_05 AC 125 ms
54,216 KB
testcase_06 AC 134 ms
54,504 KB
testcase_07 AC 122 ms
54,972 KB
testcase_08 AC 125 ms
54,396 KB
testcase_09 AC 123 ms
53,068 KB
testcase_10 AC 115 ms
54,528 KB
testcase_11 AC 131 ms
53,704 KB
testcase_12 AC 130 ms
54,528 KB
testcase_13 AC 124 ms
54,468 KB
testcase_14 AC 118 ms
53,532 KB
testcase_15 AC 142 ms
54,480 KB
testcase_16 AC 125 ms
54,760 KB
testcase_17 AC 143 ms
55,104 KB
testcase_18 AC 128 ms
54,604 KB
testcase_19 AC 116 ms
53,276 KB
testcase_20 AC 120 ms
52,696 KB
testcase_21 AC 139 ms
54,476 KB
testcase_22 AC 136 ms
54,600 KB
testcase_23 AC 133 ms
55,028 KB
testcase_24 AC 114 ms
53,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt(), max = 0, min = 200, t, x, y;
		for (int i = 0; i < n; i++) {
			t = sc.nextInt();
			max = Math.max(max, t);
			min = Math.min(min, t);
		}
		if (max == min) {
			if ((n - 1) * 2 == max) {
				System.out.println(n + " 0");
			} else {
				System.out.println("0 " + n);
			}
		} else {
			x = n;
			y = 0;
			min += 4;
			while (x * 2 + y * 4 != min) {
				x--;
				y++;
			}
			System.out.println(x + " " + y);
		}
	}
}
0