結果

問題 No.29 パワーアップ
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-09 15:15:25
言語 Java19
(openjdk 19.0.1)
結果
AC  
実行時間 141 ms / 5,000 ms
コード長 591 bytes
コンパイル時間 2,206 ms
コンパイル使用メモリ 71,000 KB
実行使用メモリ 56,200 KB
最終ジャッジ日時 2023-07-29 02:46:21
合計ジャッジ時間 6,558 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,616 KB
testcase_01 AC 123 ms
55,756 KB
testcase_02 AC 124 ms
55,908 KB
testcase_03 AC 125 ms
55,600 KB
testcase_04 AC 124 ms
55,732 KB
testcase_05 AC 136 ms
55,572 KB
testcase_06 AC 138 ms
55,356 KB
testcase_07 AC 130 ms
56,160 KB
testcase_08 AC 127 ms
55,652 KB
testcase_09 AC 123 ms
56,200 KB
testcase_10 AC 136 ms
55,408 KB
testcase_11 AC 141 ms
55,668 KB
testcase_12 AC 125 ms
55,928 KB
testcase_13 AC 136 ms
56,144 KB
testcase_14 AC 138 ms
55,980 KB
testcase_15 AC 138 ms
55,412 KB
testcase_16 AC 140 ms
55,728 KB
testcase_17 AC 130 ms
56,012 KB
testcase_18 AC 133 ms
54,032 KB
testcase_19 AC 132 ms
55,920 KB
testcase_20 AC 124 ms
55,908 KB
testcase_21 AC 122 ms
56,036 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