結果

問題 No.112 ややこしい鶴亀算
ユーザー Kinoshita
提出日時 2015-09-19 17:24:11
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 594 bytes
コンパイル時間 2,335 ms
コンパイル使用メモリ 79,808 KB
実行使用メモリ 42,608 KB
最終ジャッジ日時 2024-07-19 08:04:59
合計ジャッジ時間 6,960 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int[] n = new int[sc.nextInt()];
		int turu = 0, kame = 0;
		
		for(int i = 0; i < n.length; i++)
			n[i] = sc.nextInt();
		
		Arrays.sort(n);
		
		if(n[0] != n[1]){
			if(n[0] == 2){
				kame = n.length - 1;
				turu = 1;
			}
			else{
				turu = n.length - 1;
				kame = 1;
			}	
		}
		else{
			if(n[0] / (n.length - 1) == 2)turu = n.length;
			else kame = n.length;
		}
		
		System.out.println(turu + " " + kame);
		
		sc.close();
	}
}
0