結果

問題 No.29 パワーアップ
ユーザー GrenacheGrenache
提出日時 2015-09-22 23:24:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 147 ms / 5,000 ms
コード長 596 bytes
コンパイル時間 3,211 ms
コンパイル使用メモリ 72,076 KB
実行使用メモリ 56,268 KB
最終ジャッジ日時 2023-09-26 14:30:35
合計ジャッジ時間 7,412 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,476 KB
testcase_01 AC 122 ms
55,836 KB
testcase_02 AC 122 ms
55,948 KB
testcase_03 AC 124 ms
55,748 KB
testcase_04 AC 123 ms
56,268 KB
testcase_05 AC 136 ms
55,888 KB
testcase_06 AC 136 ms
55,752 KB
testcase_07 AC 130 ms
55,712 KB
testcase_08 AC 126 ms
55,872 KB
testcase_09 AC 122 ms
55,700 KB
testcase_10 AC 139 ms
56,028 KB
testcase_11 AC 147 ms
55,596 KB
testcase_12 AC 124 ms
55,752 KB
testcase_13 AC 135 ms
55,764 KB
testcase_14 AC 135 ms
55,936 KB
testcase_15 AC 136 ms
55,788 KB
testcase_16 AC 136 ms
55,828 KB
testcase_17 AC 124 ms
55,860 KB
testcase_18 AC 129 ms
55,744 KB
testcase_19 AC 130 ms
55,688 KB
testcase_20 AC 120 ms
55,704 KB
testcase_21 AC 116 ms
55,768 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