結果

問題 No.29 パワーアップ
ユーザー doyazaki012doyazaki012
提出日時 2015-05-01 18:03:16
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 115 ms / 5,000 ms
コード長 502 bytes
コンパイル時間 1,733 ms
使用メモリ 51,120 KB
最終ジャッジ日時 2023-02-08 00:06:54
合計ジャッジ時間 5,505 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 98 ms
51,100 KB
testcase_01 AC 98 ms
51,012 KB
testcase_02 AC 102 ms
50,888 KB
testcase_03 AC 100 ms
51,028 KB
testcase_04 AC 100 ms
50,932 KB
testcase_05 AC 111 ms
50,996 KB
testcase_06 AC 111 ms
51,060 KB
testcase_07 AC 106 ms
50,904 KB
testcase_08 AC 103 ms
51,028 KB
testcase_09 AC 100 ms
51,120 KB
testcase_10 AC 115 ms
50,792 KB
testcase_11 AC 113 ms
51,040 KB
testcase_12 AC 102 ms
51,104 KB
testcase_13 AC 107 ms
51,064 KB
testcase_14 AC 112 ms
50,980 KB
testcase_15 AC 109 ms
50,712 KB
testcase_16 AC 110 ms
50,924 KB
testcase_17 AC 103 ms
50,996 KB
testcase_18 AC 103 ms
50,864 KB
testcase_19 AC 106 ms
50,780 KB
testcase_20 AC 104 ms
51,100 KB
testcase_21 AC 101 ms
51,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Yuki29{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);

		int n = stdIn.nextInt();
		int[] count = new int[10];
		int box=0;
		int answer=0;


		for(int i=0;i<n*3;i++){
			int input = stdIn.nextInt();
			if(input==10) input =0;
			
			count[input] += 1;
			if(count[input]==2){
				count[input] -= 2;
				answer += 1;
			}

		}

		for(int  i=0;i<10;i++){
			box+=count[i];
		}

		answer += (int)(box/4);

		System.out.println(answer);
	}
}
0