結果

問題 No.29 パワーアップ
ユーザー AoiroFukurouAoiroFukurou
提出日時 2016-07-10 17:15:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 571 bytes
コンパイル時間 3,213 ms
コンパイル使用メモリ 74,960 KB
実行使用メモリ 41,692 KB
最終ジャッジ日時 2024-04-21 12:02:56
合計ジャッジ時間 7,077 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
40,012 KB
testcase_01 AC 109 ms
41,368 KB
testcase_02 AC 114 ms
40,916 KB
testcase_03 AC 107 ms
40,172 KB
testcase_04 AC 112 ms
41,308 KB
testcase_05 AC 129 ms
41,460 KB
testcase_06 AC 123 ms
41,148 KB
testcase_07 AC 130 ms
41,400 KB
testcase_08 AC 117 ms
41,280 KB
testcase_09 AC 104 ms
40,576 KB
testcase_10 AC 139 ms
41,540 KB
testcase_11 AC 125 ms
41,280 KB
testcase_12 AC 119 ms
41,656 KB
testcase_13 AC 125 ms
41,140 KB
testcase_14 AC 127 ms
41,560 KB
testcase_15 AC 127 ms
41,624 KB
testcase_16 WA -
testcase_17 AC 116 ms
41,116 KB
testcase_18 AC 125 ms
41,692 KB
testcase_19 AC 126 ms
41,356 KB
testcase_20 AC 116 ms
41,192 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

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(PUC == 4){
			PUC = 0;
			C++;
		}
		if(item[i] >= 1){
			item[i] -= 1;
			PUC++;
		}
	}
	System.out.println(C);
}
}
0