結果
| 問題 |
No.582 キャンディー・ボックス3
|
| コンテスト | |
| ユーザー |
donkorin_
|
| 提出日時 | 2018-10-14 12:09:26 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,390 bytes |
| コンパイル時間 | 1,390 ms |
| コンパイル使用メモリ | 167,004 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 18:17:38 |
| 合計ジャッジ時間 | 2,051 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vii = vector<int>;
using vll = vector<ll>;
template<class T>using vv = vector<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}
int n,c[151], cnt;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin >> n;
rep(i, 0, n) {
int x; cin >> x;
if (x) c[i] = x, cnt++;
}
int sum = accumulate(ALL(c), 0);
int one = count(ALL(c), 1);
int two = count(ALL(c), 2);
if (sum == 0) {
cout << "B" << endl;
return 0;
}
if (*max_element(ALL(c)) == 1) {
if (sum % 2) cout << "A" << endl;
else cout << "B" << endl;
return 0;
}
if (two == 1 && cnt == (one + two) && one % 2) cout << "A" << endl;
else cout << "B" << endl;
return 0;
}
donkorin_