結果

問題 No.112 ややこしい鶴亀算
ユーザー 37zigen37zigen
提出日時 2016-03-31 19:01:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 161 ms / 5,000 ms
コード長 448 bytes
コンパイル時間 2,038 ms
コンパイル使用メモリ 75,932 KB
実行使用メモリ 55,288 KB
最終ジャッジ日時 2024-04-10 06:51:13
合計ジャッジ時間 6,462 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
54,784 KB
testcase_01 AC 128 ms
54,284 KB
testcase_02 AC 140 ms
55,056 KB
testcase_03 AC 130 ms
54,448 KB
testcase_04 AC 142 ms
54,992 KB
testcase_05 AC 131 ms
54,612 KB
testcase_06 AC 145 ms
54,980 KB
testcase_07 AC 144 ms
55,104 KB
testcase_08 AC 128 ms
54,512 KB
testcase_09 AC 146 ms
54,936 KB
testcase_10 AC 143 ms
55,052 KB
testcase_11 AC 138 ms
54,492 KB
testcase_12 AC 135 ms
53,828 KB
testcase_13 AC 144 ms
55,044 KB
testcase_14 AC 152 ms
55,056 KB
testcase_15 AC 150 ms
54,860 KB
testcase_16 AC 153 ms
54,964 KB
testcase_17 AC 143 ms
53,236 KB
testcase_18 AC 154 ms
55,132 KB
testcase_19 AC 151 ms
55,160 KB
testcase_20 AC 147 ms
53,704 KB
testcase_21 AC 161 ms
55,288 KB
testcase_22 AC 154 ms
54,836 KB
testcase_23 AC 157 ms
54,996 KB
testcase_24 AC 137 ms
54,652 KB
権限があれば一括ダウンロードができます

ソースコード

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