結果

問題 No.29 パワーアップ
ユーザー tom_tom_tomtom_tom_tom
提出日時 2015-11-07 20:05:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 5,000 ms
コード長 638 bytes
コンパイル時間 3,371 ms
コンパイル使用メモリ 72,972 KB
実行使用メモリ 56,220 KB
最終ジャッジ日時 2023-10-11 15:13:48
合計ジャッジ時間 7,150 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
56,040 KB
testcase_01 AC 125 ms
55,692 KB
testcase_02 AC 123 ms
56,096 KB
testcase_03 AC 127 ms
55,992 KB
testcase_04 AC 125 ms
55,924 KB
testcase_05 AC 140 ms
56,220 KB
testcase_06 AC 141 ms
55,700 KB
testcase_07 AC 129 ms
55,612 KB
testcase_08 AC 132 ms
55,480 KB
testcase_09 AC 129 ms
55,536 KB
testcase_10 AC 142 ms
55,744 KB
testcase_11 AC 143 ms
55,968 KB
testcase_12 AC 124 ms
55,740 KB
testcase_13 AC 137 ms
55,956 KB
testcase_14 AC 143 ms
55,744 KB
testcase_15 AC 138 ms
56,072 KB
testcase_16 AC 138 ms
55,852 KB
testcase_17 AC 130 ms
55,432 KB
testcase_18 AC 130 ms
55,852 KB
testcase_19 AC 131 ms
55,780 KB
testcase_20 AC 123 ms
55,816 KB
testcase_21 AC 123 ms
55,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder;

import java.util.Scanner;

/**
 * http://yukicoder.me/problems/1
 */
public class YukiCoder29 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] items = new int[10];

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 3; j++) {
                items[sc.nextInt() - 1]++;
            }
        }

        int diffs = 0;
        int num = 0;
        for (int item : items) {
            num += item / 2;
            diffs += item % 2;
        }
        num += diffs / 4;

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