結果

問題 No.112 ややこしい鶴亀算
ユーザー KinoshitaKinoshita
提出日時 2015-09-19 17:50:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 161 ms / 5,000 ms
コード長 482 bytes
コンパイル時間 2,128 ms
コンパイル使用メモリ 74,548 KB
実行使用メモリ 57,224 KB
最終ジャッジ日時 2023-09-26 13:47:15
合計ジャッジ時間 7,107 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 155 ms
56,904 KB
testcase_01 AC 150 ms
57,224 KB
testcase_02 AC 149 ms
56,720 KB
testcase_03 AC 149 ms
56,500 KB
testcase_04 AC 150 ms
57,104 KB
testcase_05 AC 148 ms
55,032 KB
testcase_06 AC 150 ms
56,992 KB
testcase_07 AC 150 ms
56,780 KB
testcase_08 AC 153 ms
56,784 KB
testcase_09 AC 149 ms
56,876 KB
testcase_10 AC 148 ms
54,620 KB
testcase_11 AC 151 ms
56,720 KB
testcase_12 AC 151 ms
56,744 KB
testcase_13 AC 148 ms
56,716 KB
testcase_14 AC 156 ms
56,836 KB
testcase_15 AC 157 ms
56,516 KB
testcase_16 AC 155 ms
56,712 KB
testcase_17 AC 161 ms
56,792 KB
testcase_18 AC 159 ms
56,804 KB
testcase_19 AC 157 ms
56,864 KB
testcase_20 AC 154 ms
56,472 KB
testcase_21 AC 157 ms
56,744 KB
testcase_22 AC 155 ms
56,672 KB
testcase_23 AC 154 ms
56,948 KB
testcase_24 AC 154 ms
56,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int[] n = new int[sc.nextInt()];
		int turu = 0, kame = 0, sum = 0;
		
		for(int i = 0; i < n.length; i++){
			n[i] = sc.nextInt();
			sum += n[i];
		}
		sum = sum / (n.length - 1);
		
		for(int i = 0; i < n.length; i++){
			if(sum - n[i] == 2)turu++;
			if(sum - n[i] == 4)kame++;
		}
		
		System.out.println(turu + " " + kame);
		
		sc.close();
	}
}
0