結果

問題 No.29 パワーアップ
ユーザー ohagi_1182
提出日時 2017-10-21 14:37:02
言語 Java
(openjdk 23)
結果
AC  
実行時間 148 ms / 5,000 ms
コード長 475 bytes
コンパイル時間 2,270 ms
コンパイル使用メモリ 74,180 KB
実行使用メモリ 54,340 KB
最終ジャッジ日時 2024-11-21 12:30:31
合計ジャッジ時間 5,961 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] x = new int[11];
		for(int i = 0 ; i < n ; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			x[a]++; x[b]++; x[c]++;
		}
		int ans = 0; int cnt = 0;
		for(int i = 0 ; i < 11 ; i++) {
			ans += x[i] / 2;
			cnt += x[i] % 2;
		}
		ans += cnt / 4;
		System.out.println(ans);
 	}
}

0