結果

問題 No.29 パワーアップ
ユーザー lrf141lrf141
提出日時 2016-12-01 14:25:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 724 bytes
コンパイル時間 5,318 ms
コンパイル使用メモリ 71,284 KB
実行使用メモリ 56,392 KB
最終ジャッジ日時 2023-08-18 11:17:50
合計ジャッジ時間 8,222 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
55,864 KB
testcase_01 AC 113 ms
55,768 KB
testcase_02 AC 115 ms
55,728 KB
testcase_03 AC 117 ms
55,904 KB
testcase_04 AC 112 ms
54,172 KB
testcase_05 AC 130 ms
56,108 KB
testcase_06 AC 128 ms
56,168 KB
testcase_07 AC 123 ms
56,024 KB
testcase_08 AC 120 ms
56,232 KB
testcase_09 AC 119 ms
55,660 KB
testcase_10 AC 136 ms
55,892 KB
testcase_11 AC 136 ms
55,984 KB
testcase_12 AC 122 ms
56,124 KB
testcase_13 AC 135 ms
55,540 KB
testcase_14 AC 136 ms
55,864 KB
testcase_15 AC 131 ms
56,144 KB
testcase_16 AC 128 ms
55,792 KB
testcase_17 AC 122 ms
56,392 KB
testcase_18 AC 131 ms
56,020 KB
testcase_19 AC 133 ms
55,868 KB
testcase_20 AC 121 ms
55,872 KB
testcase_21 AC 118 ms
55,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class no29{
    public static void main(String... args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int res = 0,tmp;
        int array[] = new int[10];

        for(int i = 0; i < n; i++){
            for(int j = 0; j < 3; j++){
                tmp = scan.nextInt();
                array[tmp-1]++;
                if(array[tmp-1] == 2){
                    array[tmp-1] = 0;
                    res++;
                }
            }
        }

        tmp = 0;
        for(int i = 0; i < 10; i++)
            tmp += array[i];

        while(4 <= tmp){
            tmp -= 4;
            res++;
        }

        System.out.println(res);

    }
}
0