結果

問題 No.29 パワーアップ
ユーザー tom_tom_tomtom_tom_tom
提出日時 2015-11-07 20:05:01
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 110 ms / 5,000 ms
コード長 638 bytes
コンパイル時間 2,722 ms
使用メモリ 37,816 KB
最終ジャッジ日時 2023-02-25 18:02:18
合計ジャッジ時間 6,339 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 96 ms
37,456 KB
testcase_01 AC 95 ms
37,336 KB
testcase_02 AC 94 ms
37,468 KB
testcase_03 AC 96 ms
37,524 KB
testcase_04 AC 95 ms
37,360 KB
testcase_05 AC 108 ms
37,752 KB
testcase_06 AC 106 ms
37,688 KB
testcase_07 AC 102 ms
37,560 KB
testcase_08 AC 97 ms
37,492 KB
testcase_09 AC 94 ms
37,612 KB
testcase_10 AC 109 ms
37,816 KB
testcase_11 AC 110 ms
37,672 KB
testcase_12 AC 99 ms
37,584 KB
testcase_13 AC 107 ms
37,796 KB
testcase_14 AC 106 ms
37,524 KB
testcase_15 AC 107 ms
37,628 KB
testcase_16 AC 101 ms
37,808 KB
testcase_17 AC 99 ms
37,676 KB
testcase_18 AC 105 ms
37,644 KB
testcase_19 AC 100 ms
37,700 KB
testcase_20 AC 100 ms
37,408 KB
testcase_21 AC 96 ms
37,636 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