結果

問題 No.112 ややこしい鶴亀算
ユーザー fal_rndfal_rnd
提出日時 2018-04-25 09:39:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 167 ms / 5,000 ms
コード長 745 bytes
コンパイル時間 2,354 ms
コンパイル使用メモリ 78,984 KB
実行使用メモリ 57,408 KB
最終ジャッジ日時 2023-09-10 05:24:15
合計ジャッジ時間 7,668 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 157 ms
56,840 KB
testcase_01 AC 157 ms
56,888 KB
testcase_02 AC 156 ms
56,864 KB
testcase_03 AC 157 ms
56,916 KB
testcase_04 AC 158 ms
56,840 KB
testcase_05 AC 157 ms
56,548 KB
testcase_06 AC 156 ms
57,116 KB
testcase_07 AC 158 ms
56,972 KB
testcase_08 AC 157 ms
56,984 KB
testcase_09 AC 157 ms
57,156 KB
testcase_10 AC 156 ms
56,604 KB
testcase_11 AC 158 ms
56,792 KB
testcase_12 AC 157 ms
56,976 KB
testcase_13 AC 160 ms
56,776 KB
testcase_14 AC 163 ms
57,016 KB
testcase_15 AC 161 ms
57,148 KB
testcase_16 AC 164 ms
56,876 KB
testcase_17 AC 162 ms
57,236 KB
testcase_18 AC 164 ms
56,872 KB
testcase_19 AC 162 ms
57,332 KB
testcase_20 AC 164 ms
57,408 KB
testcase_21 AC 166 ms
57,108 KB
testcase_22 AC 167 ms
57,156 KB
testcase_23 AC 166 ms
55,148 KB
testcase_24 AC 163 ms
57,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.util.stream.*;
class Main {
    static Scanner s=new Scanner(System.in);
    static int gInt(){return Integer.parseInt(s.next());}
    public static void main(String[]$){
        int n=gInt();
        int[]a=new int[n];
        for(int i=0;i<n;++i){
            a[i]=gInt();
        }
        int[]kinds=Arrays.stream(a).distinct().sorted().toArray();
        int turu=0,kame=0;
        if(kinds.length==1){
            if(kinds[0]/(n-1)==2)
                turu=n;
            else
            kame=n;
        }else{
            for(int i:a)
                if(kinds[1]==i)
                    ++turu;
                else
                    ++kame;
        }
        System.out.println(turu+" "+kame);
    }
}
0