結果

問題 No.29 パワーアップ
ユーザー abcabc
提出日時 2016-10-21 11:50:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 157 ms / 5,000 ms
コード長 844 bytes
コンパイル時間 2,274 ms
コンパイル使用メモリ 74,500 KB
実行使用メモリ 41,824 KB
最終ジャッジ日時 2024-05-02 21:19:17
合計ジャッジ時間 6,373 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
41,128 KB
testcase_01 AC 134 ms
41,656 KB
testcase_02 AC 133 ms
41,468 KB
testcase_03 AC 138 ms
41,660 KB
testcase_04 AC 136 ms
41,508 KB
testcase_05 AC 151 ms
41,368 KB
testcase_06 AC 144 ms
41,364 KB
testcase_07 AC 140 ms
41,468 KB
testcase_08 AC 124 ms
40,196 KB
testcase_09 AC 120 ms
40,188 KB
testcase_10 AC 147 ms
41,588 KB
testcase_11 AC 149 ms
41,824 KB
testcase_12 AC 137 ms
41,088 KB
testcase_13 AC 153 ms
41,384 KB
testcase_14 AC 150 ms
41,464 KB
testcase_15 AC 150 ms
41,620 KB
testcase_16 AC 157 ms
41,532 KB
testcase_17 AC 143 ms
41,132 KB
testcase_18 AC 144 ms
41,408 KB
testcase_19 AC 146 ms
41,256 KB
testcase_20 AC 136 ms
41,460 KB
testcase_21 AC 139 ms
41,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int numEnemys = sc.nextInt();

        int ItemsTotal[] = new int[10];

        for (int i = 0; i < numEnemys; i++) {

            int item1 = sc.nextInt();
            int item2 = sc.nextInt();
            int item3 = sc.nextInt();

            ItemsTotal[item1 - 1]++;
            ItemsTotal[item2 - 1]++;
            ItemsTotal[item3 - 1]++;

        }

        int powerUp = 0;
        int other = 0;

        for (int i = 0; i < 10; i++) {

            if (ItemsTotal[i] >= 2) {
                powerUp += ItemsTotal[i] / 2;
            }

            other += ItemsTotal[i] % 2;

        }

        int maxPowerUp = powerUp + (other / 4);

        System.out.println(maxPowerUp);

    }

}
0