結果

問題 No.29 パワーアップ
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-09 15:14:17
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 564 bytes
コンパイル時間 3,049 ms
コンパイル使用メモリ 73,988 KB
実行使用メモリ 41,892 KB
最終ジャッジ日時 2024-04-16 09:49:20
合計ジャッジ時間 6,086 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 133 ms
41,388 KB
testcase_02 AC 129 ms
41,024 KB
testcase_03 WA -
testcase_04 AC 128 ms
41,196 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 131 ms
41,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 129 ms
41,296 KB
testcase_21 AC 129 ms
41,236 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) {
				times += ar[i]/2;
				ar[i] = 1;
			}
		}
		
		
		
		int sum = 0;
		for (int i=0; i<ar.length; i++) {
			sum += ar[i];
		}
		System.out.println(times+(sum/4));
	}
}
0