結果

問題 No.29 パワーアップ
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-21 14:37:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 146 ms / 5,000 ms
コード長 475 bytes
コンパイル時間 2,316 ms
コンパイル使用メモリ 74,420 KB
実行使用メモリ 42,208 KB
最終ジャッジ日時 2024-05-01 09:13:58
合計ジャッジ時間 6,516 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
41,464 KB
testcase_01 AC 129 ms
41,316 KB
testcase_02 AC 129 ms
41,728 KB
testcase_03 AC 122 ms
39,892 KB
testcase_04 AC 130 ms
41,440 KB
testcase_05 AC 141 ms
41,704 KB
testcase_06 AC 146 ms
42,208 KB
testcase_07 AC 139 ms
41,724 KB
testcase_08 AC 143 ms
41,344 KB
testcase_09 AC 131 ms
41,704 KB
testcase_10 AC 140 ms
41,396 KB
testcase_11 AC 145 ms
41,740 KB
testcase_12 AC 130 ms
41,908 KB
testcase_13 AC 144 ms
41,948 KB
testcase_14 AC 141 ms
41,372 KB
testcase_15 AC 146 ms
41,496 KB
testcase_16 AC 145 ms
41,456 KB
testcase_17 AC 138 ms
41,780 KB
testcase_18 AC 139 ms
41,596 KB
testcase_19 AC 145 ms
41,548 KB
testcase_20 AC 131 ms
41,416 KB
testcase_21 AC 136 ms
41,616 KB
権限があれば一括ダウンロードができます

ソースコード

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