結果

問題 No.112 ややこしい鶴亀算
ユーザー ffmm00ffmm00
提出日時 2015-06-15 21:21:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 160 ms / 5,000 ms
コード長 447 bytes
コンパイル時間 4,066 ms
コンパイル使用メモリ 73,772 KB
実行使用メモリ 57,052 KB
最終ジャッジ日時 2023-09-21 02:20:20
合計ジャッジ時間 9,139 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 149 ms
57,052 KB
testcase_01 AC 150 ms
56,864 KB
testcase_02 AC 154 ms
56,532 KB
testcase_03 AC 151 ms
56,560 KB
testcase_04 AC 151 ms
56,812 KB
testcase_05 AC 147 ms
57,024 KB
testcase_06 AC 151 ms
56,812 KB
testcase_07 AC 154 ms
55,316 KB
testcase_08 AC 153 ms
56,896 KB
testcase_09 AC 150 ms
56,884 KB
testcase_10 AC 152 ms
56,520 KB
testcase_11 AC 151 ms
56,728 KB
testcase_12 AC 155 ms
56,780 KB
testcase_13 AC 154 ms
56,952 KB
testcase_14 AC 160 ms
56,860 KB
testcase_15 AC 159 ms
56,784 KB
testcase_16 AC 160 ms
56,828 KB
testcase_17 AC 158 ms
56,640 KB
testcase_18 AC 154 ms
56,928 KB
testcase_19 AC 157 ms
56,504 KB
testcase_20 AC 158 ms
56,756 KB
testcase_21 AC 157 ms
56,732 KB
testcase_22 AC 155 ms
56,984 KB
testcase_23 AC 160 ms
56,536 KB
testcase_24 AC 158 ms
56,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class N112 {

	public static void main(String[] args) {

		Scanner sca = new Scanner(System.in);
		int n = sca.nextInt();
		int[] a = new int[n];
		int sum = 0;
		int t = 0;
		int k = 0;

		for (int i = 0; i < n; i++) {
			a[i] = sca.nextInt();
			sum += a[i];
		}

		sum /= (n - 1);

		for (int i = 0; i < n; i++) {
			if (sum - a[i] == 2)
				t++;
			else
				k++;
		}

		System.out.println(t + " " + k);

	}

}
0