結果

問題 No.29 パワーアップ
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-07 16:08:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 147 ms / 5,000 ms
コード長 669 bytes
コンパイル時間 1,924 ms
コンパイル使用メモリ 70,960 KB
実行使用メモリ 56,516 KB
最終ジャッジ日時 2023-09-17 15:46:14
合計ジャッジ時間 5,973 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,704 KB
testcase_01 AC 122 ms
56,212 KB
testcase_02 AC 122 ms
55,924 KB
testcase_03 AC 123 ms
56,152 KB
testcase_04 AC 122 ms
56,516 KB
testcase_05 AC 139 ms
56,252 KB
testcase_06 AC 136 ms
56,152 KB
testcase_07 AC 136 ms
55,632 KB
testcase_08 AC 130 ms
56,004 KB
testcase_09 AC 124 ms
55,860 KB
testcase_10 AC 143 ms
55,544 KB
testcase_11 AC 141 ms
55,908 KB
testcase_12 AC 123 ms
55,992 KB
testcase_13 AC 136 ms
55,596 KB
testcase_14 AC 138 ms
55,868 KB
testcase_15 AC 138 ms
55,508 KB
testcase_16 AC 147 ms
55,776 KB
testcase_17 AC 131 ms
55,988 KB
testcase_18 AC 135 ms
55,992 KB
testcase_19 AC 138 ms
55,988 KB
testcase_20 AC 122 ms
55,680 KB
testcase_21 AC 126 ms
55,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner koko = new Scanner(System.in);
        int n = koko.nextInt();
        int[] b = new int[n*3];
        int[] item = new int[10];
        for(int i=0; i<n*3; i++){
            b[i] = koko.nextInt();
            item[b[i]-1]++;
        }
        int amari = 0;
        int count = 0;
        int m;
        for(int i=0; i<10;i++){
            m = item[i]%2;
            count = count + ((item[i]-m)/2);
            amari = amari + m;
        }
        int mm = amari%4;
        count = count + ((amari-mm)/4);
        System.out.println(count);
    }
}
0