結果

問題 No.29 パワーアップ
ユーザー suiginginsuigingin
提出日時 2015-07-07 22:28:39
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 110 ms / 5,000 ms
コード長 539 bytes
コンパイル時間 3,707 ms
使用メモリ 37,872 KB
最終ジャッジ日時 2023-02-11 10:53:06
合計ジャッジ時間 6,567 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 96 ms
37,612 KB
testcase_01 AC 95 ms
37,772 KB
testcase_02 AC 93 ms
37,456 KB
testcase_03 AC 95 ms
37,604 KB
testcase_04 AC 97 ms
37,468 KB
testcase_05 AC 107 ms
37,672 KB
testcase_06 AC 103 ms
37,532 KB
testcase_07 AC 98 ms
37,552 KB
testcase_08 AC 97 ms
37,872 KB
testcase_09 AC 94 ms
37,612 KB
testcase_10 AC 105 ms
37,784 KB
testcase_11 AC 108 ms
37,704 KB
testcase_12 AC 92 ms
37,716 KB
testcase_13 AC 98 ms
37,500 KB
testcase_14 AC 110 ms
37,864 KB
testcase_15 AC 99 ms
37,492 KB
testcase_16 AC 97 ms
37,356 KB
testcase_17 AC 94 ms
37,376 KB
testcase_18 AC 102 ms
37,420 KB
testcase_19 AC 99 ms
37,656 KB
testcase_20 AC 92 ms
37,372 KB
testcase_21 AC 92 ms
37,644 KB
権限があれば一括ダウンロードができます

ソースコード

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