結果

問題 No.29 パワーアップ
ユーザー face4face4
提出日時 2018-04-16 21:55:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 772 bytes
コンパイル時間 1,949 ms
コンパイル使用メモリ 71,136 KB
実行使用メモリ 49,816 KB
最終ジャッジ日時 2023-09-09 10:58:00
合計ジャッジ時間 3,802 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,292 KB
testcase_01 AC 42 ms
49,128 KB
testcase_02 AC 43 ms
49,308 KB
testcase_03 AC 42 ms
49,116 KB
testcase_04 AC 43 ms
49,328 KB
testcase_05 AC 44 ms
49,260 KB
testcase_06 AC 44 ms
49,080 KB
testcase_07 AC 42 ms
49,380 KB
testcase_08 AC 42 ms
49,776 KB
testcase_09 AC 42 ms
49,088 KB
testcase_10 AC 44 ms
49,256 KB
testcase_11 AC 43 ms
49,244 KB
testcase_12 AC 42 ms
49,228 KB
testcase_13 AC 43 ms
49,080 KB
testcase_14 AC 43 ms
49,308 KB
testcase_15 AC 44 ms
49,164 KB
testcase_16 AC 43 ms
49,308 KB
testcase_17 AC 42 ms
49,352 KB
testcase_18 AC 43 ms
49,816 KB
testcase_19 AC 43 ms
49,132 KB
testcase_20 AC 42 ms
49,064 KB
testcase_21 AC 43 ms
49,068 KB
権限があれば一括ダウンロードができます

ソースコード

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