結果

問題 No.582 キャンディー・ボックス3
ユーザー takeya_okinotakeya_okino
提出日時 2017-10-27 22:58:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 1,889 ms
コンパイル使用メモリ 73,988 KB
実行使用メモリ 41,616 KB
最終ジャッジ日時 2024-05-02 01:32:07
合計ジャッジ時間 4,982 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
40,968 KB
testcase_01 AC 121 ms
41,344 KB
testcase_02 AC 112 ms
40,576 KB
testcase_03 AC 122 ms
41,324 KB
testcase_04 AC 102 ms
39,652 KB
testcase_05 AC 104 ms
40,196 KB
testcase_06 AC 102 ms
40,012 KB
testcase_07 AC 117 ms
40,936 KB
testcase_08 AC 103 ms
40,312 KB
testcase_09 AC 112 ms
41,180 KB
testcase_10 AC 102 ms
40,428 KB
testcase_11 AC 111 ms
41,204 KB
testcase_12 AC 112 ms
41,124 KB
testcase_13 AC 121 ms
41,308 KB
testcase_14 AC 124 ms
41,548 KB
testcase_15 AC 125 ms
41,372 KB
testcase_16 AC 126 ms
41,360 KB
testcase_17 AC 128 ms
41,448 KB
testcase_18 AC 127 ms
41,160 KB
testcase_19 AC 126 ms
41,616 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 count = 0;
    int one = 0;
    int two = 0;
    for(int i = 0; i < n; i++) {
      int c = sc.nextInt();
      if(c > 2) count++;
      if(c == 1) one++;
      if(c == 2) two++;
    }
    String ans = "B";
    if((count == 0) && (two == 0) && (one % 2 == 1)) ans = "A";
    if((count == 0) && (two <= 1) && (one % 2 == 1)) ans = "A"; 
    System.out.println(ans);
  }
}
0