結果

問題 No.112 ややこしい鶴亀算
ユーザー 練習生練習生
提出日時 2015-08-22 10:20:08
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 675 bytes
コンパイル時間 3,427 ms
コンパイル使用メモリ 73,444 KB
実行使用メモリ 58,780 KB
最終ジャッジ日時 2023-09-25 15:59:33
合計ジャッジ時間 8,885 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
55,060 KB
testcase_01 AC 157 ms
56,704 KB
testcase_02 AC 155 ms
56,640 KB
testcase_03 AC 158 ms
57,072 KB
testcase_04 AC 154 ms
56,376 KB
testcase_05 WA -
testcase_06 AC 158 ms
56,708 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 156 ms
56,904 KB
testcase_10 AC 156 ms
56,420 KB
testcase_11 AC 158 ms
56,736 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 165 ms
56,472 KB
testcase_15 AC 162 ms
56,840 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 160 ms
56,692 KB
testcase_21 AC 160 ms
58,780 KB
testcase_22 AC 164 ms
56,888 KB
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class No112 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int case1 = sc.nextInt(), case2 = 0;
		int case1Count = 1, case2Count = 0;
		int turu = 0, kame = 0;
		for(int i = 0; i < (n - 1); i++){
			if(sc.nextInt() == case1){
				case1Count++;
			}else{
				case2Count++;
			}
		}
		sc.close();
		if(case1 > case2){
			turu =case1Count;
			kame = case2Count;
		}else if(case1 < case2){
			turu = case2Count;
			kame = case1Count;
		}else{
			if(((n * 2) - 2) == case1){
				turu = case1Count;
			}else{
				kame = case1Count;
			}
		}
		System.out.println(turu + " " + kame);
	}
}
0