結果

問題 No.29 パワーアップ
ユーザー GrenacheGrenache
提出日時 2015-09-22 23:24:30
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 113 ms / 5,000 ms
コード長 596 bytes
コンパイル時間 2,809 ms
使用メモリ 38,756 KB
最終ジャッジ日時 2023-02-17 15:19:12
合計ジャッジ時間 6,590 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 97 ms
37,664 KB
testcase_01 AC 95 ms
37,284 KB
testcase_02 AC 100 ms
38,308 KB
testcase_03 AC 97 ms
37,512 KB
testcase_04 AC 98 ms
37,480 KB
testcase_05 AC 109 ms
38,276 KB
testcase_06 AC 105 ms
37,792 KB
testcase_07 AC 104 ms
37,396 KB
testcase_08 AC 100 ms
37,420 KB
testcase_09 AC 93 ms
37,368 KB
testcase_10 AC 113 ms
37,876 KB
testcase_11 AC 104 ms
38,336 KB
testcase_12 AC 101 ms
38,356 KB
testcase_13 AC 107 ms
37,696 KB
testcase_14 AC 113 ms
37,780 KB
testcase_15 AC 108 ms
37,872 KB
testcase_16 AC 106 ms
38,452 KB
testcase_17 AC 95 ms
38,344 KB
testcase_18 AC 109 ms
38,344 KB
testcase_19 AC 101 ms
38,756 KB
testcase_20 AC 99 ms
37,412 KB
testcase_21 AC 100 ms
38,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder29 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] nn = new int[10];
        for (int i = 0; i < n; i++) {
        	for (int j = 0; j < 3; j++) {
        		int a = sc.nextInt() - 1;
        		nn[a]++;
        	}
        }

        int ret = 0;
        int tmp = 0;
        for (int i = 0; i < 10; i++) {
        	ret += nn[i] / 2;
        	tmp += nn[i] % 2;
        }
        ret += tmp / 4;
        
		System.out.println(ret);

		sc.close();
    }
}
0