結果

問題 No.29 パワーアップ
ユーザー Grenache
提出日時 2015-09-22 23:24:30
言語 Java
(openjdk 23)
結果
AC  
実行時間 146 ms / 5,000 ms
コード長 596 bytes
コンパイル時間 3,321 ms
コンパイル使用メモリ 75,128 KB
実行使用メモリ 41,904 KB
最終ジャッジ日時 2024-07-19 08:43:01
合計ジャッジ時間 6,645 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder29 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] nn = new int[10];
        for (int i = 0; i < n; i++) {
        	for (int j = 0; j < 3; j++) {
        		int a = sc.nextInt() - 1;
        		nn[a]++;
        	}
        }

        int ret = 0;
        int tmp = 0;
        for (int i = 0; i < 10; i++) {
        	ret += nn[i] / 2;
        	tmp += nn[i] % 2;
        }
        ret += tmp / 4;
        
		System.out.println(ret);

		sc.close();
    }
}
0