P12063 题解
题意简述
这不是神之一手吗。
让我们比比柯洁和卞相壹哪个人的棋盒盖先被塞爆。
思路
每次提子判断当前盒盖是否已经被塞爆,如果被塞爆了,判断当前是谁提子,然后输出,结束程序。如果到最后没有退出就是平局。
代码
#include <bits/stdc++.h>
using namespace std;
#define debug cerr<<"The code runs successfully.\n";
#define endl '\n'
#define TRACE 1
#define tcout TRACE && cout
#define fst ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define int long long
const int P = 998244353;
const int Base = 33331;
const int INF = 0x3f3f3f3f3f3f3f3f;
const int N = 1e6 + 10, M = 2e6 + 10;
int a[2],n,m;//a[0]代表白棋盒盖,a[1]相反
signed main() {
fst;
cin>>n>>m;
for(int i=1;i<=n;i++) {
int x;
cin>>x;
a[i&1]+=x;
if(a[i&1]>m) {//当前盒盖被塞满
if(i&1) cout<<"White\n";//黑棋盒盖被塞满,黑棋输,白棋赢
else cout<<"Black\n";//相反
return 0;//胜负已定
}
}
cout<<"Draw\n";//平局的情况
return 0;
}