結果

問題 No.29 パワーアップ
ユーザー kohaku_kohaku
提出日時 2016-11-11 04:52:38
言語 Java
(openjdk 23)
結果
AC  
実行時間 149 ms / 5,000 ms
コード長 624 bytes
コンパイル時間 2,021 ms
コンパイル使用メモリ 74,272 KB
実行使用メモリ 54,316 KB
最終ジャッジ日時 2024-11-25 07:44:46
合計ジャッジ時間 6,108 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

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