結果

問題 No.29 パワーアップ
ユーザー nCk_cvnCk_cv
提出日時 2016-02-01 20:57:17
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 110 ms / 5,000 ms
コード長 465 bytes
コンパイル時間 1,618 ms
使用メモリ 37,820 KB
最終ジャッジ日時 2022-11-20 23:16:44
合計ジャッジ時間 5,904 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 96 ms
37,472 KB
testcase_01 AC 93 ms
37,356 KB
testcase_02 AC 95 ms
37,540 KB
testcase_03 AC 92 ms
37,584 KB
testcase_04 AC 95 ms
37,612 KB
testcase_05 AC 106 ms
37,696 KB
testcase_06 AC 109 ms
37,712 KB
testcase_07 AC 104 ms
37,668 KB
testcase_08 AC 99 ms
37,692 KB
testcase_09 AC 100 ms
37,312 KB
testcase_10 AC 109 ms
37,820 KB
testcase_11 AC 110 ms
37,680 KB
testcase_12 AC 99 ms
37,536 KB
testcase_13 AC 99 ms
37,528 KB
testcase_14 AC 106 ms
37,516 KB
testcase_15 AC 107 ms
37,516 KB
testcase_16 AC 101 ms
37,724 KB
testcase_17 AC 100 ms
37,532 KB
testcase_18 AC 103 ms
37,516 KB
testcase_19 AC 103 ms
37,596 KB
testcase_20 AC 100 ms
37,440 KB
testcase_21 AC 99 ms
37,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;
import java.io.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] sum = new int[10];
		
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < 3; j++) {
				sum[sc.nextInt()-1]++;
			}
		}
		int ans = 0;
		int a = 0;
		for(int i = 0; i < 10; i++) {
			ans += sum[i] / 2;
			a += sum[i] % 2;
		}
		ans += a/4;
		System.out.println(ans);
	}
}
0