結果

問題 No.29 パワーアップ
ユーザー TatsuDXTatsuDX
提出日時 2016-09-08 23:32:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 115 ms / 5,000 ms
コード長 403 bytes
コンパイル時間 3,329 ms
コンパイル使用メモリ 71,884 KB
実行使用メモリ 56,188 KB
最終ジャッジ日時 2023-08-10 00:00:20
合計ジャッジ時間 5,951 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
55,916 KB
testcase_01 AC 110 ms
56,012 KB
testcase_02 AC 103 ms
56,028 KB
testcase_03 AC 106 ms
55,748 KB
testcase_04 AC 102 ms
56,188 KB
testcase_05 AC 115 ms
55,392 KB
testcase_06 AC 112 ms
53,960 KB
testcase_07 AC 110 ms
55,776 KB
testcase_08 AC 104 ms
55,380 KB
testcase_09 AC 102 ms
55,808 KB
testcase_10 AC 114 ms
55,576 KB
testcase_11 AC 115 ms
55,652 KB
testcase_12 AC 103 ms
55,904 KB
testcase_13 AC 113 ms
55,848 KB
testcase_14 AC 110 ms
55,860 KB
testcase_15 AC 114 ms
55,788 KB
testcase_16 AC 114 ms
55,652 KB
testcase_17 AC 105 ms
55,428 KB
testcase_18 AC 108 ms
55,696 KB
testcase_19 AC 110 ms
55,972 KB
testcase_20 AC 99 ms
55,844 KB
testcase_21 AC 99 ms
55,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int[] t = new int[10];
		int n = sc.nextInt() * 3, cnt = 0;
		for (int i = 0; i < n; i++) {
			t[sc.nextInt() - 1]++;
		}
		for (int i = 0; i < 10; i++) {
			while (t[i] >= 2) {
				cnt++;
				n -= 2;
				t[i] -= 2;
			}
		}
		cnt += n / 4;
		System.out.println(cnt);
	}
}
0