結果

問題 No.29 パワーアップ
ユーザー face4
提出日時 2018-04-16 21:55:19
言語 Java
(openjdk 23)
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 772 bytes
コンパイル時間 1,975 ms
コンパイル使用メモリ 74,904 KB
実行使用メモリ 50,376 KB
最終ジャッジ日時 2024-06-27 04:05:33
合計ジャッジ時間 4,102 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] items = new int[11];
        while(n-- > 0){
            String[] input = br.readLine().split(" ");
            for(int i = 0; i < 3; i++){
                items[Integer.parseInt(input[i])]++;
            }
        }
        int rest = 0;
        int score = 0;
        for(int i = 1; i <= 10; i++){
            score += items[i]/2;
            rest += items[i]%2;
        }

        score += rest / 4;

        System.out.println(score);
    }  
}          
0