結果

問題 No.29 パワーアップ
ユーザー jp_ste
提出日時 2014-11-09 17:02:20
言語 Java
(openjdk 23)
結果
AC  
実行時間 59 ms / 5,000 ms
コード長 851 bytes
コンパイル時間 2,230 ms
コンパイル使用メモリ 75,280 KB
実行使用メモリ 50,488 KB
最終ジャッジ日時 2024-12-31 08:52:38
合計ジャッジ時間 4,349 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(r.readLine());
		int list[] = new int[10];
		
		StringTokenizer st;
		for(int i=0; i<n; i++) {
			st = new StringTokenizer(r.readLine());
			int a = Integer.parseInt(st.nextToken());
			int b = Integer.parseInt(st.nextToken());
			int c = Integer.parseInt(st.nextToken());
			list[a-1]++;
			list[b-1]++;
			list[c-1]++;
		}
		
		int ans = 0;
		int oddNum = 0;
		for(int i=0; i<10; i++) {
			ans += (list[i] / 2);
			if( list[i] % 2 == 1 ) oddNum++;
		}
		ans += (oddNum /4);
		System.out.println(ans);
	}
}
0