結果

問題 No.29 パワーアップ
ユーザー 37zigen37zigen
提出日時 2016-04-01 16:06:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 155 ms / 5,000 ms
コード長 496 bytes
コンパイル時間 2,641 ms
コンパイル使用メモリ 75,128 KB
実行使用メモリ 54,688 KB
最終ジャッジ日時 2024-04-10 07:05:58
合計ジャッジ時間 6,322 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
54,568 KB
testcase_01 AC 136 ms
54,008 KB
testcase_02 AC 137 ms
54,232 KB
testcase_03 AC 139 ms
54,128 KB
testcase_04 AC 138 ms
54,224 KB
testcase_05 AC 155 ms
54,688 KB
testcase_06 AC 150 ms
54,140 KB
testcase_07 AC 145 ms
54,252 KB
testcase_08 AC 142 ms
54,372 KB
testcase_09 AC 137 ms
54,140 KB
testcase_10 AC 151 ms
54,364 KB
testcase_11 AC 153 ms
54,160 KB
testcase_12 AC 139 ms
54,164 KB
testcase_13 AC 151 ms
54,492 KB
testcase_14 AC 150 ms
54,228 KB
testcase_15 AC 151 ms
54,596 KB
testcase_16 AC 153 ms
54,328 KB
testcase_17 AC 141 ms
54,228 KB
testcase_18 AC 146 ms
54,284 KB
testcase_19 AC 148 ms
54,412 KB
testcase_20 AC 140 ms
54,448 KB
testcase_21 AC 136 ms
54,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder029;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int[] memo=new int[10];
		int n=sc.nextInt();
		for(int i=0;i<n;i++){
			for(int j=0;j<3;j++){
				memo[sc.nextInt()-1]++;
			}
		}
		Arrays.sort(memo);
		int count=0;
		int res=0;
		for(int i=0;i<10;i++){
			count+=memo[i]/2;
			memo[i]-=memo[i]/2*2;
			res+=memo[i];
		}
		count+=res/4;
		System.out.println(count);
	}
}
0