結果

問題 No.29 パワーアップ
ユーザー kano_townkano_town
提出日時 2014-11-21 14:13:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 140 ms / 5,000 ms
コード長 517 bytes
コンパイル時間 3,028 ms
コンパイル使用メモリ 71,800 KB
実行使用メモリ 56,248 KB
最終ジャッジ日時 2023-08-30 22:08:44
合計ジャッジ時間 7,139 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
55,916 KB
testcase_01 AC 114 ms
55,720 KB
testcase_02 AC 116 ms
56,116 KB
testcase_03 AC 115 ms
55,508 KB
testcase_04 AC 115 ms
55,636 KB
testcase_05 AC 128 ms
56,100 KB
testcase_06 AC 126 ms
55,900 KB
testcase_07 AC 124 ms
56,232 KB
testcase_08 AC 115 ms
55,984 KB
testcase_09 AC 112 ms
55,884 KB
testcase_10 AC 125 ms
55,948 KB
testcase_11 AC 140 ms
55,644 KB
testcase_12 AC 115 ms
55,488 KB
testcase_13 AC 124 ms
56,248 KB
testcase_14 AC 126 ms
54,148 KB
testcase_15 AC 128 ms
56,076 KB
testcase_16 AC 131 ms
55,604 KB
testcase_17 AC 118 ms
56,204 KB
testcase_18 AC 123 ms
55,880 KB
testcase_19 AC 121 ms
55,560 KB
testcase_20 AC 112 ms
55,656 KB
testcase_21 AC 114 ms
55,552 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