結果

問題 No.112 ややこしい鶴亀算
ユーザー kano_town
提出日時 2015-01-01 01:43:38
言語 Java
(openjdk 23)
結果
AC  
実行時間 164 ms / 5,000 ms
コード長 581 bytes
コンパイル時間 4,789 ms
コンパイル使用メモリ 76,816 KB
実行使用メモリ 55,128 KB
最終ジャッジ日時 2024-06-13 01:10:03
合計ジャッジ時間 8,657 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Yukicoder112 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), kame = 0, tsuru = 0;
		int[] a = new int[n];
		int max = -1, min = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			max = Math.max(max, a[i]);
			min = Math.min(min, a[i]);
		}

		if (max == min)
			if (max / (n - 1) == 4) kame = n;
			else tsuru = n;
		else
			for (int i = 0; i < n; i++) {
				if (a[i] == max) tsuru++;
				else kame++;
			}
		System.out.println(tsuru + " " + kame);
	}
}
0