結果

問題 No.112 ややこしい鶴亀算
ユーザー nCk_cvnCk_cv
提出日時 2015-09-19 17:42:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 162 ms / 5,000 ms
コード長 475 bytes
コンパイル時間 2,417 ms
コンパイル使用メモリ 73,988 KB
実行使用メモリ 56,996 KB
最終ジャッジ日時 2023-09-26 13:46:57
合計ジャッジ時間 7,008 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 162 ms
56,796 KB
testcase_01 AC 148 ms
56,548 KB
testcase_02 AC 146 ms
56,564 KB
testcase_03 AC 147 ms
56,940 KB
testcase_04 AC 147 ms
56,448 KB
testcase_05 AC 147 ms
56,488 KB
testcase_06 AC 147 ms
56,576 KB
testcase_07 AC 149 ms
56,548 KB
testcase_08 AC 148 ms
56,520 KB
testcase_09 AC 148 ms
56,280 KB
testcase_10 AC 148 ms
56,468 KB
testcase_11 AC 151 ms
56,996 KB
testcase_12 AC 146 ms
56,500 KB
testcase_13 AC 147 ms
56,516 KB
testcase_14 AC 154 ms
56,512 KB
testcase_15 AC 153 ms
56,756 KB
testcase_16 AC 153 ms
56,700 KB
testcase_17 AC 156 ms
56,892 KB
testcase_18 AC 155 ms
56,256 KB
testcase_19 AC 153 ms
56,580 KB
testcase_20 AC 152 ms
56,544 KB
testcase_21 AC 154 ms
56,644 KB
testcase_22 AC 153 ms
56,632 KB
testcase_23 AC 152 ms
56,512 KB
testcase_24 AC 154 ms
56,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;
import java.io.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sum = 0;
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			sum += a[i];
		}
		int total = sum / (n-1);
		int t = 0;
		for(int i = 0; i < n; i++) {
			if(total - a[i] == 2) t++;
		}
		System.out.println(t + " " + (n-t));
		
		
		
		
		
		
		
		
		
	}

}
0