結果

問題 No.29 パワーアップ
ユーザー AoiroFukurouAoiroFukurou
提出日時 2016-07-10 17:24:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 571 bytes
コンパイル時間 4,014 ms
コンパイル使用メモリ 75,340 KB
実行使用メモリ 54,392 KB
最終ジャッジ日時 2024-04-21 12:03:08
合計ジャッジ時間 8,679 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
54,292 KB
testcase_01 AC 104 ms
52,984 KB
testcase_02 AC 100 ms
53,024 KB
testcase_03 AC 112 ms
54,168 KB
testcase_04 AC 98 ms
53,060 KB
testcase_05 AC 122 ms
54,324 KB
testcase_06 AC 134 ms
53,868 KB
testcase_07 AC 119 ms
53,952 KB
testcase_08 AC 107 ms
53,100 KB
testcase_09 AC 111 ms
54,140 KB
testcase_10 AC 117 ms
53,952 KB
testcase_11 AC 124 ms
53,492 KB
testcase_12 AC 116 ms
54,212 KB
testcase_13 AC 123 ms
54,096 KB
testcase_14 AC 128 ms
54,196 KB
testcase_15 AC 124 ms
54,056 KB
testcase_16 AC 119 ms
54,136 KB
testcase_17 AC 111 ms
53,984 KB
testcase_18 AC 119 ms
54,072 KB
testcase_19 AC 117 ms
54,232 KB
testcase_20 AC 100 ms
52,976 KB
testcase_21 AC 119 ms
54,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class No_29v2 {
public static void main(String[] args) {
	int[] item = new int[11];
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt() * 3;
	for(int i = 0; i < N; i++){
		item[sc.nextInt()]++;
	}
	int C = 0;
	for(int i = 1; i <= 10; i++){
		if(item[i] >= 2){
			while(item[i] >= 2){
				item[i] -= 2;
				C++;
			}
		}
	}
	int PUC = 0;//Power UP Counting
	for(int i = 1; i <= 10; i++){
		if(item[i] != 0){
			item[i] -= 1;
			PUC++;
		}
		if(PUC == 4){
			PUC = 0;
			C++;
		}
	}
	System.out.println(C);
}
}
0