結果

問題 No.29 パワーアップ
ユーザー nCk_cvnCk_cv
提出日時 2016-02-01 20:57:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 155 ms / 5,000 ms
コード長 465 bytes
コンパイル時間 2,334 ms
コンパイル使用メモリ 74,412 KB
実行使用メモリ 57,636 KB
最終ジャッジ日時 2023-10-21 18:32:31
合計ジャッジ時間 6,702 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
57,348 KB
testcase_01 AC 134 ms
57,596 KB
testcase_02 AC 131 ms
57,268 KB
testcase_03 AC 136 ms
57,472 KB
testcase_04 AC 133 ms
57,072 KB
testcase_05 AC 150 ms
57,612 KB
testcase_06 AC 145 ms
57,636 KB
testcase_07 AC 137 ms
57,544 KB
testcase_08 AC 135 ms
57,404 KB
testcase_09 AC 132 ms
57,308 KB
testcase_10 AC 155 ms
57,628 KB
testcase_11 AC 148 ms
57,564 KB
testcase_12 AC 138 ms
57,184 KB
testcase_13 AC 143 ms
55,948 KB
testcase_14 AC 152 ms
57,472 KB
testcase_15 AC 152 ms
57,636 KB
testcase_16 AC 154 ms
57,172 KB
testcase_17 AC 142 ms
57,436 KB
testcase_18 AC 140 ms
57,600 KB
testcase_19 AC 140 ms
55,372 KB
testcase_20 AC 133 ms
57,480 KB
testcase_21 AC 128 ms
57,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;
import java.io.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] sum = new int[10];
		
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < 3; j++) {
				sum[sc.nextInt()-1]++;
			}
		}
		int ans = 0;
		int a = 0;
		for(int i = 0; i < 10; i++) {
			ans += sum[i] / 2;
			a += sum[i] % 2;
		}
		ans += a/4;
		System.out.println(ans);
	}
}
0