結果

問題 No.29 パワーアップ
ユーザー jp_stejp_ste
提出日時 2014-11-09 17:02:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 46 ms / 5,000 ms
コード長 851 bytes
コンパイル時間 2,105 ms
コンパイル使用メモリ 71,940 KB
実行使用メモリ 49,916 KB
最終ジャッジ日時 2023-08-30 02:47:39
合計ジャッジ時間 4,148 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,376 KB
testcase_01 AC 44 ms
49,916 KB
testcase_02 AC 44 ms
49,440 KB
testcase_03 AC 45 ms
49,792 KB
testcase_04 AC 43 ms
49,488 KB
testcase_05 AC 45 ms
49,488 KB
testcase_06 AC 46 ms
49,312 KB
testcase_07 AC 45 ms
49,444 KB
testcase_08 AC 44 ms
47,972 KB
testcase_09 AC 46 ms
49,496 KB
testcase_10 AC 46 ms
49,296 KB
testcase_11 AC 46 ms
49,532 KB
testcase_12 AC 45 ms
49,472 KB
testcase_13 AC 46 ms
49,316 KB
testcase_14 AC 45 ms
49,828 KB
testcase_15 AC 45 ms
49,420 KB
testcase_16 AC 45 ms
49,452 KB
testcase_17 AC 45 ms
49,448 KB
testcase_18 AC 44 ms
49,376 KB
testcase_19 AC 46 ms
49,440 KB
testcase_20 AC 44 ms
49,680 KB
testcase_21 AC 43 ms
49,432 KB
権限があれば一括ダウンロードができます

ソースコード

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