結果

問題 No.29 パワーアップ
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-07 16:08:21
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 110 ms / 5,000 ms
コード長 669 bytes
コンパイル時間 1,818 ms
使用メモリ 42,600 KB
最終ジャッジ日時 2023-02-06 02:36:42
合計ジャッジ時間 5,335 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 97 ms
38,772 KB
testcase_01 AC 94 ms
40,344 KB
testcase_02 AC 99 ms
40,180 KB
testcase_03 AC 97 ms
42,408 KB
testcase_04 AC 97 ms
42,600 KB
testcase_05 AC 109 ms
40,248 KB
testcase_06 AC 100 ms
40,344 KB
testcase_07 AC 96 ms
40,452 KB
testcase_08 AC 95 ms
40,316 KB
testcase_09 AC 97 ms
42,444 KB
testcase_10 AC 106 ms
40,308 KB
testcase_11 AC 110 ms
40,544 KB
testcase_12 AC 97 ms
40,340 KB
testcase_13 AC 103 ms
40,204 KB
testcase_14 AC 107 ms
40,468 KB
testcase_15 AC 105 ms
39,116 KB
testcase_16 AC 102 ms
38,596 KB
testcase_17 AC 97 ms
40,360 KB
testcase_18 AC 103 ms
42,256 KB
testcase_19 AC 99 ms
42,400 KB
testcase_20 AC 97 ms
42,468 KB
testcase_21 AC 99 ms
42,408 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