結果

問題 No.29 パワーアップ
ユーザー suiginginsuigingin
提出日時 2015-07-07 22:28:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 5,000 ms
コード長 539 bytes
コンパイル時間 3,171 ms
コンパイル使用メモリ 72,696 KB
実行使用メモリ 56,636 KB
最終ジャッジ日時 2023-09-22 09:23:22
合計ジャッジ時間 7,130 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,868 KB
testcase_01 AC 119 ms
55,776 KB
testcase_02 AC 120 ms
55,840 KB
testcase_03 AC 121 ms
56,144 KB
testcase_04 AC 120 ms
55,512 KB
testcase_05 AC 136 ms
56,036 KB
testcase_06 AC 137 ms
56,544 KB
testcase_07 AC 127 ms
55,852 KB
testcase_08 AC 124 ms
55,496 KB
testcase_09 AC 119 ms
55,820 KB
testcase_10 AC 137 ms
55,944 KB
testcase_11 AC 137 ms
55,844 KB
testcase_12 AC 122 ms
55,856 KB
testcase_13 AC 132 ms
55,928 KB
testcase_14 AC 135 ms
55,968 KB
testcase_15 AC 138 ms
56,112 KB
testcase_16 AC 136 ms
55,504 KB
testcase_17 AC 126 ms
56,228 KB
testcase_18 AC 130 ms
55,944 KB
testcase_19 AC 129 ms
56,636 KB
testcase_20 AC 120 ms
55,964 KB
testcase_21 AC 119 ms
56,204 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