結果

問題 No.29 パワーアップ
ユーザー kenji_shioyakenji_shioya
提出日時 2016-07-05 00:37:40
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 446 bytes
コンパイル時間 3,316 ms
使用メモリ 40,504 KB
最終ジャッジ日時 2022-12-06 00:13:41
合計ジャッジ時間 6,975 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 106 ms
40,436 KB
testcase_01 AC 107 ms
38,180 KB
testcase_02 AC 105 ms
38,196 KB
testcase_03 AC 108 ms
40,204 KB
testcase_04 AC 104 ms
38,332 KB
testcase_05 AC 121 ms
40,504 KB
testcase_06 AC 119 ms
40,392 KB
testcase_07 AC 117 ms
40,260 KB
testcase_08 AC 113 ms
38,340 KB
testcase_09 AC 108 ms
38,456 KB
testcase_10 AC 123 ms
40,324 KB
testcase_11 AC 122 ms
40,420 KB
testcase_12 AC 106 ms
38,268 KB
testcase_13 AC 117 ms
39,092 KB
testcase_14 AC 117 ms
38,520 KB
testcase_15 AC 114 ms
38,568 KB
testcase_16 AC 118 ms
40,272 KB
testcase_17 AC 104 ms
40,428 KB
testcase_18 AC 116 ms
38,532 KB
testcase_19 AC 115 ms
38,320 KB
testcase_20 AC 111 ms
38,368 KB
testcase_21 AC 104 ms
40,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise145{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int[] array = new int[11];
    int a = 0;
    int h = 0;

    for(int i = 0; i < n * 3; i++){
      array[sc.nextInt()]++;
    }
    for(int i = 1; i < 11; i++){
      a += array[i] / 2;
      if(array[i] % 2 == 1){
        h++;
      }
    }
    System.out.println(a + h / 4);
  }
}
0