結果

問題 No.112 ややこしい鶴亀算
ユーザー Aru hokodateAru hokodate
提出日時 2018-10-18 17:48:49
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 575 bytes
コンパイル時間 4,433 ms
コンパイル使用メモリ 77,352 KB
実行使用メモリ 55,248 KB
最終ジャッジ日時 2024-04-24 11:57:49
合計ジャッジ時間 7,621 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
54,784 KB
testcase_01 WA -
testcase_02 AC 139 ms
55,140 KB
testcase_03 AC 137 ms
54,764 KB
testcase_04 WA -
testcase_05 AC 138 ms
54,488 KB
testcase_06 AC 145 ms
54,768 KB
testcase_07 AC 134 ms
54,308 KB
testcase_08 AC 147 ms
54,844 KB
testcase_09 WA -
testcase_10 AC 145 ms
55,092 KB
testcase_11 AC 135 ms
54,936 KB
testcase_12 AC 129 ms
54,596 KB
testcase_13 AC 127 ms
55,124 KB
testcase_14 WA -
testcase_15 AC 145 ms
54,772 KB
testcase_16 AC 157 ms
54,884 KB
testcase_17 AC 150 ms
55,248 KB
testcase_18 AC 132 ms
54,724 KB
testcase_19 AC 128 ms
54,336 KB
testcase_20 WA -
testcase_21 AC 143 ms
54,868 KB
testcase_22 AC 143 ms
55,072 KB
testcase_23 AC 129 ms
54,520 KB
testcase_24 AC 144 ms
54,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Yuki4 {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int leg[] = new int[n];
        int x=0;
        int y=0;
        int z=0;
        for(int i=0;i<n;i++) {
            leg[i] = scan.nextInt();
        }

        for(int i=0;i<n;i++){
            if(leg[0]==leg[i]) x++;
            else z=i;
        }
        y=n-x;

        if(2*x+4*y==leg[0]+2&&2*x+4*y==leg[z]+4)System.out.println(x+" "+y);
        else System.out.println(y+" "+x);

    }
}
0