結果

問題 No.29 パワーアップ
ユーザー kano_townkano_town
提出日時 2014-11-21 14:13:50
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 115 ms / 5,000 ms
コード長 517 bytes
コンパイル時間 2,944 ms
使用メモリ 37,660 KB
最終ジャッジ日時 2023-01-17 18:41:19
合計ジャッジ時間 6,529 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 96 ms
37,548 KB
testcase_01 AC 96 ms
37,476 KB
testcase_02 AC 95 ms
37,316 KB
testcase_03 AC 96 ms
37,320 KB
testcase_04 AC 96 ms
37,464 KB
testcase_05 AC 109 ms
37,496 KB
testcase_06 AC 107 ms
37,440 KB
testcase_07 AC 106 ms
37,416 KB
testcase_08 AC 101 ms
37,500 KB
testcase_09 AC 94 ms
37,236 KB
testcase_10 AC 115 ms
37,552 KB
testcase_11 AC 112 ms
37,584 KB
testcase_12 AC 100 ms
37,420 KB
testcase_13 AC 100 ms
37,504 KB
testcase_14 AC 108 ms
37,660 KB
testcase_15 AC 111 ms
37,640 KB
testcase_16 AC 103 ms
37,596 KB
testcase_17 AC 98 ms
37,360 KB
testcase_18 AC 105 ms
37,556 KB
testcase_19 AC 99 ms
37,376 KB
testcase_20 AC 98 ms
37,340 KB
testcase_21 AC 96 ms
37,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Yukicoder29 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] item = new int[10];

		Arrays.fill(item, 0);
		for (int i = 0; i < n * 3; i++) {
			item[sc.nextInt() - 1]++;
		}

		int res = 0, other = 0;
		for (int i = 0; i < 10; i++) {
			if (item[i] >= 2) {
				res += item[i] / 2;
			}
			other += item[i] % 2;
		}
		System.out.println(res + other / 4);
	}
}
0