結果

問題 No.29 パワーアップ
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-11 04:52:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 5,000 ms
コード長 624 bytes
コンパイル時間 4,660 ms
コンパイル使用メモリ 71,968 KB
実行使用メモリ 56,472 KB
最終ジャッジ日時 2023-08-16 18:15:50
合計ジャッジ時間 8,847 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,360 KB
testcase_01 AC 121 ms
56,184 KB
testcase_02 AC 121 ms
55,748 KB
testcase_03 AC 123 ms
56,036 KB
testcase_04 AC 123 ms
55,800 KB
testcase_05 AC 138 ms
56,052 KB
testcase_06 AC 138 ms
56,388 KB
testcase_07 AC 130 ms
56,356 KB
testcase_08 AC 125 ms
56,108 KB
testcase_09 AC 124 ms
55,852 KB
testcase_10 AC 143 ms
55,636 KB
testcase_11 AC 143 ms
56,172 KB
testcase_12 AC 123 ms
56,256 KB
testcase_13 AC 133 ms
55,928 KB
testcase_14 AC 137 ms
55,960 KB
testcase_15 AC 135 ms
55,708 KB
testcase_16 AC 135 ms
55,836 KB
testcase_17 AC 125 ms
56,056 KB
testcase_18 AC 128 ms
55,932 KB
testcase_19 AC 128 ms
56,228 KB
testcase_20 AC 120 ms
56,156 KB
testcase_21 AC 120 ms
56,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int [] item = new int [10];
        for(int i=0; i<N; i++){
            int a = sc.nextInt();
            item[a-1]+=1;
            int b = sc.nextInt();
            item[b-1]+=1;
            int c = sc.nextInt();
            item[c-1]+=1;
        }
        int c=0;
        int s=0;
        for(int i=0; i<10; i++){
            c = c + item[i]/2 ;
            s = s + item[i]%2 ;
        }
        int r = c + s/4 ;
        System.out.println(r);
    }
}
0