結果

問題 No.29 パワーアップ
ユーザー kenji_shioyakenji_shioya
提出日時 2016-07-05 00:37:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 446 bytes
コンパイル時間 3,005 ms
コンパイル使用メモリ 77,024 KB
実行使用メモリ 41,968 KB
最終ジャッジ日時 2024-04-20 21:59:15
合計ジャッジ時間 6,566 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
41,088 KB
testcase_01 AC 116 ms
40,124 KB
testcase_02 AC 115 ms
40,156 KB
testcase_03 AC 115 ms
40,536 KB
testcase_04 AC 115 ms
41,004 KB
testcase_05 AC 130 ms
41,604 KB
testcase_06 AC 134 ms
41,564 KB
testcase_07 AC 123 ms
41,408 KB
testcase_08 AC 100 ms
40,116 KB
testcase_09 AC 106 ms
40,688 KB
testcase_10 AC 126 ms
41,968 KB
testcase_11 AC 129 ms
41,424 KB
testcase_12 AC 104 ms
40,056 KB
testcase_13 AC 124 ms
41,468 KB
testcase_14 AC 126 ms
41,524 KB
testcase_15 AC 132 ms
41,072 KB
testcase_16 AC 118 ms
41,184 KB
testcase_17 AC 107 ms
40,820 KB
testcase_18 AC 120 ms
41,400 KB
testcase_19 AC 128 ms
41,560 KB
testcase_20 AC 105 ms
39,884 KB
testcase_21 AC 102 ms
40,756 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