結果

問題 No.29 パワーアップ
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-09 15:15:25
言語 Java19
(openjdk 19.0.1)
結果
AC  
実行時間 119 ms / 5,000 ms
コード長 591 bytes
コンパイル時間 1,985 ms
実行使用メモリ 38,112 KB
最終ジャッジ日時 2022-11-29 15:52:00
合計ジャッジ時間 5,797 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
37,464 KB
testcase_01 AC 104 ms
37,648 KB
testcase_02 AC 104 ms
37,472 KB
testcase_03 AC 104 ms
37,544 KB
testcase_04 AC 103 ms
37,352 KB
testcase_05 AC 118 ms
37,612 KB
testcase_06 AC 110 ms
37,544 KB
testcase_07 AC 100 ms
37,676 KB
testcase_08 AC 98 ms
37,368 KB
testcase_09 AC 98 ms
37,596 KB
testcase_10 AC 112 ms
37,912 KB
testcase_11 AC 119 ms
38,112 KB
testcase_12 AC 100 ms
37,732 KB
testcase_13 AC 107 ms
37,728 KB
testcase_14 AC 114 ms
37,584 KB
testcase_15 AC 113 ms
37,780 KB
testcase_16 AC 112 ms
37,572 KB
testcase_17 AC 107 ms
37,444 KB
testcase_18 AC 114 ms
37,576 KB
testcase_19 AC 115 ms
37,560 KB
testcase_20 AC 107 ms
37,660 KB
testcase_21 AC 104 ms
37,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int[] ar = new int[11];
		int times = 0;
		int n = sc.nextInt();
		for (int i=0; i<n; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			ar[a]++;
			ar[b]++;
			ar[c]++;
		}
		
		for (int i=0; i<ar.length; i++) {
			if (ar[i]>=2) {
				int temp = ar[i]/2;
				times += temp;
				ar[i] -= temp*2;
			}
		}
		
		
		
		int sum = 0;
		for (int i=0; i<ar.length; i++) {
			sum += ar[i];
		}
		System.out.println(times+(sum/4));
	}
}
0