結果

問題 No.29 パワーアップ
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-09 15:15:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 149 ms / 5,000 ms
コード長 591 bytes
コンパイル時間 2,468 ms
コンパイル使用メモリ 74,748 KB
実行使用メモリ 41,924 KB
最終ジャッジ日時 2024-04-16 10:19:43
合計ジャッジ時間 6,083 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
41,248 KB
testcase_01 AC 127 ms
41,208 KB
testcase_02 AC 127 ms
41,552 KB
testcase_03 AC 130 ms
41,208 KB
testcase_04 AC 129 ms
41,288 KB
testcase_05 AC 141 ms
41,544 KB
testcase_06 AC 142 ms
41,176 KB
testcase_07 AC 136 ms
41,356 KB
testcase_08 AC 135 ms
41,336 KB
testcase_09 AC 132 ms
41,636 KB
testcase_10 AC 144 ms
41,356 KB
testcase_11 AC 144 ms
41,916 KB
testcase_12 AC 132 ms
41,108 KB
testcase_13 AC 141 ms
41,352 KB
testcase_14 AC 149 ms
41,924 KB
testcase_15 AC 142 ms
41,656 KB
testcase_16 AC 144 ms
41,864 KB
testcase_17 AC 134 ms
41,364 KB
testcase_18 AC 140 ms
41,536 KB
testcase_19 AC 139 ms
41,408 KB
testcase_20 AC 116 ms
40,132 KB
testcase_21 AC 127 ms
41,372 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