結果

問題 No.112 ややこしい鶴亀算
ユーザー scachescache
提出日時 2015-09-19 18:03:07
言語 Java19
(openjdk 21)
結果
AC  
実行時間 155 ms / 5,000 ms
コード長 863 bytes
コンパイル時間 3,786 ms
コンパイル使用メモリ 76,880 KB
実行使用メモリ 57,236 KB
最終ジャッジ日時 2023-09-26 13:47:57
合計ジャッジ時間 8,424 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
56,412 KB
testcase_01 AC 151 ms
56,580 KB
testcase_02 AC 148 ms
56,256 KB
testcase_03 AC 155 ms
57,068 KB
testcase_04 AC 150 ms
56,824 KB
testcase_05 AC 153 ms
56,772 KB
testcase_06 AC 148 ms
56,428 KB
testcase_07 AC 148 ms
56,608 KB
testcase_08 AC 150 ms
54,844 KB
testcase_09 AC 149 ms
56,612 KB
testcase_10 AC 148 ms
56,612 KB
testcase_11 AC 153 ms
56,272 KB
testcase_12 AC 150 ms
56,456 KB
testcase_13 AC 148 ms
57,236 KB
testcase_14 AC 154 ms
57,140 KB
testcase_15 AC 154 ms
56,560 KB
testcase_16 AC 153 ms
56,652 KB
testcase_17 AC 153 ms
56,940 KB
testcase_18 AC 151 ms
56,528 KB
testcase_19 AC 152 ms
56,472 KB
testcase_20 AC 152 ms
56,696 KB
testcase_21 AC 154 ms
56,468 KB
testcase_22 AC 152 ms
57,004 KB
testcase_23 AC 153 ms
56,508 KB
testcase_24 AC 152 ms
56,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main253 {
	public static void main(String[] args) {
		Main253 p = new Main253();
	}

	public Main253() {
//		solve1();
		solve2();
		
	}

	public void solve1() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int count = 0;
		for(int i=0;i<n;i++){
			count += sc.nextInt();
		}
		
		int total = count/(n-1);
		
		int crane = (total-n*2)/2;
		System.out.println((n-crane) +" " + crane);
	}

	private void solve2(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a= new int[n];
		
		int count = 0;
		for(int i=0;i<n;i++){
			a[i] = sc.nextInt();
			count += a[i];
		}
		
		int total = count/(n-1);
		int crane = 0;
		int kame = 0;
		for(int i=0;i<n;i++){
			crane += total-a[i] == 2 ? 1 : 0;
			kame += total-a[i] == 4 ? 1 : 0;
		}
		
		System.out.println(crane + " " + kame);
	}
}
0