結果

問題 No.29 パワーアップ
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-11 04:52:38
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 624 bytes
コンパイル時間 2,478 ms
使用メモリ 49,236 KB
最終ジャッジ日時 2022-12-30 10:44:33
合計ジャッジ時間 6,564 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 108 ms
47,044 KB
testcase_01 AC 103 ms
46,640 KB
testcase_02 AC 105 ms
46,772 KB
testcase_03 AC 106 ms
49,116 KB
testcase_04 AC 100 ms
46,768 KB
testcase_05 AC 116 ms
49,172 KB
testcase_06 AC 114 ms
46,820 KB
testcase_07 AC 108 ms
46,972 KB
testcase_08 AC 104 ms
46,800 KB
testcase_09 AC 101 ms
48,912 KB
testcase_10 AC 116 ms
48,840 KB
testcase_11 AC 117 ms
48,824 KB
testcase_12 AC 103 ms
46,780 KB
testcase_13 AC 111 ms
48,892 KB
testcase_14 AC 111 ms
46,940 KB
testcase_15 AC 113 ms
46,832 KB
testcase_16 AC 112 ms
46,920 KB
testcase_17 AC 102 ms
48,912 KB
testcase_18 AC 109 ms
46,924 KB
testcase_19 AC 111 ms
46,756 KB
testcase_20 AC 106 ms
49,236 KB
testcase_21 AC 98 ms
46,744 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