結果

問題 No.29 パワーアップ
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-09 15:12:02
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 610 bytes
コンパイル時間 2,303 ms
コンパイル使用メモリ 75,496 KB
実行使用メモリ 41,868 KB
最終ジャッジ日時 2024-04-16 08:54:07
合計ジャッジ時間 6,796 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
41,476 KB
testcase_01 WA -
testcase_02 AC 147 ms
41,168 KB
testcase_03 WA -
testcase_04 AC 147 ms
41,112 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 149 ms
41,448 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 143 ms
41,300 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]++;
			if (ar[a]==2) {
				times++;
				ar[a] = 0;
			}
			if (ar[b]==2) {
				times++;
				ar[b] = 0;
			}
			if (ar[c]==2) {
				times++;
				ar[c] = 0;
			}
		}
		
		int sum = 0;
		for (int i=0; i<ar.length; i++) {
			sum += ar[i];
		}
		System.out.println(times+(sum/4));
	}
}
0