結果
| 問題 | No.582 キャンディー・ボックス3 | 
| コンテスト | |
| ユーザー |  takeya_okino | 
| 提出日時 | 2017-10-27 22:58:19 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 153 ms / 2,000 ms | 
| コード長 | 529 bytes | 
| コンパイル時間 | 2,086 ms | 
| コンパイル使用メモリ | 74,212 KB | 
| 実行使用メモリ | 41,524 KB | 
| 最終ジャッジ日時 | 2024-11-22 10:53:27 | 
| 合計ジャッジ時間 | 5,685 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 | 
ソースコード
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);
  }
}
            
            
            
        