結果

問題 No.112 ややこしい鶴亀算
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-04-03 06:14:01
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,248 bytes
コンパイル時間 3,467 ms
コンパイル使用メモリ 81,092 KB
実行使用メモリ 61,076 KB
最終ジャッジ日時 2023-09-17 03:56:44
合計ジャッジ時間 8,393 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 153 ms
56,900 KB
testcase_01 AC 137 ms
55,708 KB
testcase_02 AC 152 ms
56,680 KB
testcase_03 AC 154 ms
56,548 KB
testcase_04 AC 139 ms
56,252 KB
testcase_05 AC 138 ms
56,304 KB
testcase_06 WA -
testcase_07 AC 154 ms
55,352 KB
testcase_08 AC 141 ms
55,948 KB
testcase_09 AC 141 ms
56,040 KB
testcase_10 WA -
testcase_11 AC 152 ms
56,356 KB
testcase_12 AC 153 ms
56,880 KB
testcase_13 AC 141 ms
55,528 KB
testcase_14 AC 143 ms
55,584 KB
testcase_15 WA -
testcase_16 AC 159 ms
56,664 KB
testcase_17 AC 158 ms
56,928 KB
testcase_18 AC 158 ms
56,804 KB
testcase_19 AC 145 ms
56,644 KB
testcase_20 AC 144 ms
56,264 KB
testcase_21 WA -
testcase_22 AC 156 ms
57,052 KB
testcase_23 AC 158 ms
57,024 KB
testcase_24 AC 146 ms
55,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//No.112 ややこしい鶴亀算

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class No112 {
    
    static final Scanner sc = new Scanner(System.in);
    static final PrintWriter out = new PrintWriter(System.out,false);

    static void solve() {
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i=0; i<n; i++) {
            a[i] = sc.nextInt();
        }
        boolean f = true;
        for (int i=1; i<n; i++) {
            if (a[i] != a[i-1]) f = false;
        }
        if (f) {
            out.println(a[0]/(n-1)==2?(n+" 0"):("0 "+n));
            return;
        }
        int x = 1, y = 0, max = 0;
        for (int i=1; i<n; i++) {
            if (a[0] == a[i]) x++;
            else y++;
            max = max(max,a[i]);
        }
        if (max < a[0]) out.println(x+" "+y);
        else out.println(y+" "+x);
    }

    public static void main(String[] args) {
        long start = System.currentTimeMillis();

        solve();
        out.flush();

        long end = System.currentTimeMillis();
        //trace(end-start + "ms");
        sc.close();
    }

    static void trace(Object... o) { System.out.println(deepToString(o));}
}
0