跳到正文

题解

题解:P12063 [THUPC 2025 决赛] 我的围棋

_Charles_约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年2月15日
篇幅
约 1 分钟
题目
P12063

版本

  1. v1当前

本蒟蒻来水题解力!!

本题思路来源于@闪电侠-flash

思路

不难发现,如果哪一方的提子数>m>m就输了

所以可以对整个过程进行模拟。具体思路参考代码。。

代码

C++
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	int num1=0;//黑子数量
  int num2=0;//白子数量
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		int l;
		cin>>l;
		if(i%2==1){//一人提子一次,取余即可
			num1+=l;
			if(num1>m){//>m就输
				cout<<"White";
				return 0;
			}
		}
		else{
			num2+=l;
			if(num2>m){
				cout<<"Black";
				return 0;
			}
		}
	}
	cout<<"Draw";//最后都不输即为平手
	return 0;
}
原文