結果

問題 No.112 ややこしい鶴亀算
ユーザー dazydazy
提出日時 2016-09-13 04:23:56
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 557 bytes
コンパイル時間 3,479 ms
コンパイル使用メモリ 74,168 KB
実行使用メモリ 55,940 KB
最終ジャッジ日時 2024-04-28 12:42:12
合計ジャッジ時間 7,950 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
54,160 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 133 ms
54,140 KB
testcase_06 WA -
testcase_07 AC 133 ms
53,968 KB
testcase_08 AC 139 ms
54,200 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 141 ms
54,244 KB
testcase_12 AC 135 ms
54,116 KB
testcase_13 AC 134 ms
53,780 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 138 ms
53,972 KB
testcase_17 AC 147 ms
54,108 KB
testcase_18 AC 141 ms
54,216 KB
testcase_19 AC 143 ms
54,272 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 141 ms
54,220 KB
testcase_23 AC 140 ms
53,968 KB
testcase_24 AC 140 ms
53,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int a = scan.nextInt();
        int b;
        int x = 1;
        boolean flag = true;
        for (int i = 0; i <  N -1; i++) {
            b = scan.nextInt();
            if (a == b) x++;
            else if (flag && a < b) flag = false;
        }
        if (x == N||x*2 -2 !=a) flag = false;

        if (!flag) x = N - x;
        System.out.printf("%d %d", x, N-x);
    }
}
0