結果

問題 No.112 ややこしい鶴亀算
ユーザー spaciaspacia
提出日時 2016-01-03 16:26:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 92 ms / 5,000 ms
コード長 686 bytes
コンパイル時間 2,336 ms
コンパイル使用メモリ 75,736 KB
実行使用メモリ 56,108 KB
最終ジャッジ日時 2023-10-19 14:41:00
合計ジャッジ時間 5,500 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
56,004 KB
testcase_01 AC 80 ms
54,396 KB
testcase_02 AC 76 ms
54,340 KB
testcase_03 AC 74 ms
52,276 KB
testcase_04 AC 75 ms
54,328 KB
testcase_05 AC 76 ms
54,424 KB
testcase_06 AC 77 ms
54,312 KB
testcase_07 AC 84 ms
54,404 KB
testcase_08 AC 82 ms
55,980 KB
testcase_09 AC 82 ms
54,300 KB
testcase_10 AC 80 ms
54,584 KB
testcase_11 AC 92 ms
56,108 KB
testcase_12 AC 75 ms
54,388 KB
testcase_13 AC 86 ms
54,588 KB
testcase_14 AC 87 ms
54,628 KB
testcase_15 AC 74 ms
54,384 KB
testcase_16 AC 88 ms
54,316 KB
testcase_17 AC 88 ms
55,068 KB
testcase_18 AC 77 ms
54,580 KB
testcase_19 AC 89 ms
55,012 KB
testcase_20 AC 77 ms
54,608 KB
testcase_21 AC 77 ms
54,580 KB
testcase_22 AC 76 ms
54,568 KB
testcase_23 AC 76 ms
54,568 KB
testcase_24 AC 87 ms
54,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
		
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		String[] line = br.readLine().split(" ");
		int[] nums = new int[n];
		
		int sum = 0;
		for (int i = 0; i < n; i++) {
			nums[i] = Integer.parseInt(line[i]);
			sum += nums[i];
		}
		sum /= n - 1;
		
		int cntCrane = 0 , cntTurtle = 0;
		for (int m : nums) {
			if ((sum - m) % 4 == 0)
				cntTurtle++;
			else
				cntCrane++;
		}
		
		out(cntCrane + " " + cntTurtle);
	}
}
0