結果

問題 No.29 パワーアップ
ユーザー soujikisoujiki
提出日時 2015-04-24 20:44:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 142 ms / 5,000 ms
コード長 576 bytes
コンパイル時間 4,500 ms
コンパイル使用メモリ 72,404 KB
実行使用メモリ 56,276 KB
最終ジャッジ日時 2023-09-18 09:24:23
合計ジャッジ時間 7,243 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
53,852 KB
testcase_01 AC 123 ms
55,936 KB
testcase_02 AC 120 ms
55,736 KB
testcase_03 AC 125 ms
55,612 KB
testcase_04 AC 124 ms
56,040 KB
testcase_05 AC 139 ms
55,936 KB
testcase_06 AC 136 ms
55,660 KB
testcase_07 AC 130 ms
55,676 KB
testcase_08 AC 128 ms
55,744 KB
testcase_09 AC 124 ms
55,860 KB
testcase_10 AC 141 ms
55,656 KB
testcase_11 AC 142 ms
55,592 KB
testcase_12 AC 127 ms
55,924 KB
testcase_13 AC 138 ms
55,896 KB
testcase_14 AC 140 ms
55,908 KB
testcase_15 AC 138 ms
56,044 KB
testcase_16 AC 138 ms
56,276 KB
testcase_17 AC 128 ms
55,708 KB
testcase_18 AC 133 ms
55,464 KB
testcase_19 AC 132 ms
56,100 KB
testcase_20 AC 125 ms
55,976 KB
testcase_21 AC 123 ms
55,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Yukicoder_29{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int[] num = new int[11];

		for(int i=0;i<N;i++){
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			int c = stdIn.nextInt();
			num[a]++;
			num[b]++;
			num[c]++;
		}
		int count = 0;
		for(int i=1;i<11;i++){
			while(num[i]>=2){
				num[i] = num[i] - 2;
				count++;
			}
		}
		int counter = 0;
		for(int i=1;i<11;i++){
			counter += num[i];
		}
		count += counter/4;

		System.out.println(count);

	}

}
0