結果

問題 No.29 パワーアップ
ユーザー lrf141lrf141
提出日時 2016-12-01 14:25:27
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 724 bytes
コンパイル時間 2,901 ms
使用メモリ 37,804 KB
最終ジャッジ日時 2023-01-04 13:12:21
合計ジャッジ時間 7,115 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 105 ms
37,604 KB
testcase_01 AC 100 ms
37,804 KB
testcase_02 AC 102 ms
37,580 KB
testcase_03 AC 98 ms
37,384 KB
testcase_04 AC 102 ms
37,488 KB
testcase_05 AC 112 ms
37,652 KB
testcase_06 AC 106 ms
37,504 KB
testcase_07 AC 100 ms
37,492 KB
testcase_08 AC 100 ms
37,548 KB
testcase_09 AC 99 ms
37,692 KB
testcase_10 AC 115 ms
37,756 KB
testcase_11 AC 118 ms
37,780 KB
testcase_12 AC 104 ms
37,444 KB
testcase_13 AC 110 ms
37,680 KB
testcase_14 AC 114 ms
37,628 KB
testcase_15 AC 110 ms
37,708 KB
testcase_16 AC 111 ms
37,628 KB
testcase_17 AC 98 ms
37,524 KB
testcase_18 AC 104 ms
37,532 KB
testcase_19 AC 106 ms
37,480 KB
testcase_20 AC 103 ms
37,688 KB
testcase_21 AC 100 ms
37,624 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