結果

問題 No.29 パワーアップ
ユーザー tenten
提出日時 2020-11-10 10:16:16
言語 Java
(openjdk 23)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 511 bytes
コンパイル時間 2,045 ms
コンパイル使用メモリ 74,548 KB
実行使用メモリ 42,024 KB
最終ジャッジ日時 2024-07-22 17:18:26
合計ジャッジ時間 5,981 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] items = new int[11];
        for (int i = 0; i < n * 3; i++) {
            items[sc.nextInt()]++;
        }
        int ans = 0;
        int count = 0;
        for (int i = 1; i <= 10; i++) {
            ans += items[i] / 2;
            count += items[i] % 2;
        }
        ans += count / 4;
        System.out.println(ans);
    }
}
0