結果

問題 No.112 ややこしい鶴亀算
ユーザー 37zigen
提出日時 2016-03-31 19:01:46
言語 Java
(openjdk 23)
結果
AC  
実行時間 163 ms / 5,000 ms
コード長 448 bytes
コンパイル時間 2,169 ms
コンパイル使用メモリ 76,344 KB
実行使用メモリ 55,108 KB
最終ジャッジ日時 2024-10-02 08:31:24
合計ジャッジ時間 7,143 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder112;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		int sum=0;
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
			sum+=a[i];
		}
		sum/=n-1;
		int turtle=0;
		int crane=0;
		for(int i=0;i<n;i++){
			a[i]=sum-a[i];
			if(a[i]==2)crane++;
			if(a[i]==4)turtle++;
		}
		System.out.println(crane+" "+turtle);
	}
}
0