結果

問題 No.29 パワーアップ
ユーザー lrf141
提出日時 2016-12-01 14:25:27
言語 Java
(openjdk 23)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 724 bytes
コンパイル時間 3,287 ms
コンパイル使用メモリ 74,008 KB
実行使用メモリ 41,780 KB
最終ジャッジ日時 2024-11-27 15:44:22
合計ジャッジ時間 6,450 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

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