結果

問題 No.29 パワーアップ
ユーザー k_kadorak_kadora
提出日時 2015-05-19 03:46:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 147 ms / 5,000 ms
コード長 497 bytes
コンパイル時間 3,331 ms
コンパイル使用メモリ 72,152 KB
実行使用メモリ 56,096 KB
最終ジャッジ日時 2023-09-20 10:12:08
合計ジャッジ時間 7,577 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
56,028 KB
testcase_01 AC 128 ms
55,800 KB
testcase_02 AC 131 ms
55,820 KB
testcase_03 AC 133 ms
55,980 KB
testcase_04 AC 129 ms
55,560 KB
testcase_05 AC 143 ms
55,788 KB
testcase_06 AC 144 ms
55,752 KB
testcase_07 AC 136 ms
55,812 KB
testcase_08 AC 134 ms
55,516 KB
testcase_09 AC 129 ms
55,872 KB
testcase_10 AC 146 ms
55,820 KB
testcase_11 AC 147 ms
56,036 KB
testcase_12 AC 129 ms
55,732 KB
testcase_13 AC 141 ms
55,736 KB
testcase_14 AC 145 ms
55,932 KB
testcase_15 AC 142 ms
55,944 KB
testcase_16 AC 142 ms
55,660 KB
testcase_17 AC 133 ms
55,740 KB
testcase_18 AC 134 ms
55,848 KB
testcase_19 AC 137 ms
56,096 KB
testcase_20 AC 130 ms
56,032 KB
testcase_21 AC 127 ms
55,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Powerup{
	public static void main(String[] arg){
		int[] item = {0,0,0,0,0,0,0,0,0,0};
		int n,m,res = 0,count = 0;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		for(int i = 0;i<n;i++){
			for(int j = 0;j<3;j++){
				m = sc.nextInt();
				item[m-1]=item[m-1]+1;
			}
		}
		for(int i = 0;i<10;i++){
			while(item[i]>1){
				item[i] = item[i]-2;
				res++;
			}
			if(item[i] == 1)count++;
		}
		res = res + (count /4);
		System.out.println(res);
	}
}
0