結果

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

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class No_029 {
	Scanner sc = new Scanner(System.in);

	void run() {
		int N = sc.nextInt();
		int res = 0;
		int[] cnt = new int[10];
		while (N-- > 0) {
			cnt[sc.nextInt() - 1]++;
			cnt[sc.nextInt() - 1]++;
			cnt[sc.nextInt() - 1]++;
		}
		int sum = 0;
		for (int i = 0; i < 10; i++) {
			res += cnt[i] / 2;
			cnt[i] -= cnt[i] / 2 * 2;
			sum += cnt[i];
		}
		res += sum / 4;
		System.out.println(res);
	}

	public static void main(String[] args) {
		new No_029().run();
	}
}
0