結果
| 問題 |
No.582 キャンディー・ボックス3
|
| コンテスト | |
| ユーザー |
YamaKasa
|
| 提出日時 | 2018-09-25 14:22:56 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 142 ms / 2,000 ms |
| コード長 | 688 bytes |
| コンパイル時間 | 2,158 ms |
| コンパイル使用メモリ | 74,544 KB |
| 実行使用メモリ | 41,764 KB |
| 最終ジャッジ日時 | 2024-10-04 12:09:15 |
| 合計ジャッジ時間 | 5,250 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
boolean flag = false;
int cnt1 = 0;
int cnt2 = 0;
int cnt0 = 0;
for(int i = 0; i < N; i++) {
int C = scan.nextInt();
if(C > 2){
flag = true;
}
if(C == 1) {
cnt1++;
}
if(C == 2) {
cnt2++;
}
if(C == 0) {
cnt0++;
}
}
scan.close();
if(flag) {
System.out.println("B");
}else {
if(cnt1 == N - cnt0 && cnt1 % 2 == 1) {
System.out.println("A");
}else if(cnt2 == 1 && cnt1 % 2 == 1) {
System.out.println("A");
}else {
System.out.println("B");
}
}
}
}
YamaKasa