結果
| 問題 | 
                            No.29 パワーアップ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             abc
                         | 
                    
| 提出日時 | 2016-10-21 11:39:34 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 145 ms / 5,000 ms | 
| コード長 | 841 bytes | 
| コンパイル時間 | 2,009 ms | 
| コンパイル使用メモリ | 77,052 KB | 
| 実行使用メモリ | 46,756 KB | 
| 最終ジャッジ日時 | 2025-10-24 20:59:18 | 
| 合計ジャッジ時間 | 5,574 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 | 
ソースコード
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ItemsTotal[] = new int[10];
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            ItemsTotal[a - 1]++;
            ItemsTotal[b - 1]++;
            ItemsTotal[c - 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);
        //int maxPowerUp = other / 4;
        System.out.println(maxPowerUp);
    }
}
            
            
            
        
            
abc