結果

問題 No.29 パワーアップ
ユーザー jimanojimano
提出日時 2018-01-08 15:02:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 147 ms / 5,000 ms
コード長 516 bytes
コンパイル時間 3,285 ms
コンパイル使用メモリ 72,672 KB
実行使用メモリ 57,956 KB
最終ジャッジ日時 2023-08-25 00:34:31
合計ジャッジ時間 7,186 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,044 KB
testcase_01 AC 121 ms
55,788 KB
testcase_02 AC 120 ms
57,956 KB
testcase_03 AC 124 ms
55,880 KB
testcase_04 AC 120 ms
56,172 KB
testcase_05 AC 138 ms
56,032 KB
testcase_06 AC 135 ms
55,640 KB
testcase_07 AC 129 ms
56,300 KB
testcase_08 AC 126 ms
55,460 KB
testcase_09 AC 121 ms
55,460 KB
testcase_10 AC 137 ms
55,928 KB
testcase_11 AC 147 ms
56,188 KB
testcase_12 AC 120 ms
56,300 KB
testcase_13 AC 135 ms
56,200 KB
testcase_14 AC 133 ms
56,296 KB
testcase_15 AC 138 ms
55,772 KB
testcase_16 AC 137 ms
55,708 KB
testcase_17 AC 126 ms
55,684 KB
testcase_18 AC 131 ms
55,956 KB
testcase_19 AC 128 ms
56,228 KB
testcase_20 AC 121 ms
55,932 KB
testcase_21 AC 120 ms
56,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder.lv1;
import java.util.Scanner;

public class No0029 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] items = new int[10];

		// アイテムを格納
		for (int i = 0; i < N * 3; i++) {
			int itemNum = sc.nextInt();
			items[itemNum - 1] = items[itemNum - 1] + 1;
		}

		int upCnt = 0;
		int modCnt = 0;
		for (int i : items) {
			upCnt += i / 2;
			modCnt += i % 2;
		}
		upCnt += modCnt / 4;
		System.out.println(upCnt);
	}	
}
0