結果

問題 No.112 ややこしい鶴亀算
ユーザー nCk_cv
提出日時 2015-09-19 17:42:54
言語 Java
(openjdk 23)
結果
AC  
実行時間 157 ms / 5,000 ms
コード長 475 bytes
コンパイル時間 2,346 ms
コンパイル使用メモリ 76,652 KB
実行使用メモリ 42,692 KB
最終ジャッジ日時 2024-07-19 08:05:55
合計ジャッジ時間 6,318 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

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