Codeforces Round #281 (Div. 2)D. Vasya and Chess(博弈,想法题)
来源:互联网 发布:社交网络数据挖掘 pdf 编辑:程序博客网 时间:2024/06/05 11:34
题意:
给一个N*N的棋盘。然后一开始 白队的Queen在(1,1),黑队的Queen在(1,n)。
其余的点都是绿棋子。
Queen可以走横竖和斜线。(就是国际象棋里面Queen的走法,但是必须要吃子)。
绿子被吃了就不能走那一个格子了。
问白方先走。谁能嬴(没得走或者被吃了就死了)
当n为奇数时先手必败,只要后手和先手对称走就行了。
当n为偶数时,先手可以机智的向右走一个,后面再也不向左边走,然后就黑皇后处在先手必败的状态了。
#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<vector>using namespace std;#define rep(i,a,n) for (int i=a;i<n;i++)#define per(i,a,n) for (int i=n-1;i>=a;i--)#define pb push_back#define mp make_pair#define fi first#define se secondtypedef vector<int> VI;typedef long long ll;typedef pair<int,int> PII;const ll mod=1000000007;int main(){int n;cin >> n;if(n&1)puts("black");elseprintf("white\n1 2");return 0;}
0 0
- Codeforces Round #281 (Div. 2)D. Vasya and Chess(博弈,想法题)
- Codeforces Round #281 (Div. 2)-D. Vasya and Chess
- Codeforces Round #281 (Div. 2) C. Vasya and Basketball&D. Vasya and Chess
- Vasya and Chess - CodeForces 493 D 博弈
- codeforces 493D Vasya and Chess(博弈?)
- Codeforces Round #379 (Div. 2) D. Anton and Chess
- Codeforces Round #379 (Div. 2)-D. Anton and Chess
- Codeforces Round #281 (Div. 2) A. Vasya and Football
- Codeforces Round #281 (Div. 2) A - Vasya and Football
- CodeForces 493D Vasya and Chess
- Codeforces 493D Vasya and Chess(规律)
- Codeforces 493D Vasya and Chess
- Codeforces 493D Vasya and Chess
- Codeforces 493D Vasya and Chess 题解
- Codeforces Round #379 (Div. 2) -- D. Anton and Chess (if else 的水题)
- Codeforces Round #379 (Div. 2) D. Anton and Chess —— 基础题
- D. Vasya and Chess
- D - Vasya and Chess
- 面向对象设计七大原则
- SpringBoot四大神器之Actuator
- 169. Majority Element
- HDU 1285 确定比赛名次(拓扑排序)
- 人工智能之旅
- Codeforces Round #281 (Div. 2)D. Vasya and Chess(博弈,想法题)
- ECSHOP全版本注入漏洞分析
- 关于循环注意的细节
- SpringBoot四大神器之Starter
- [PAT]Basic Level 1003.我要通过!
- 汇编语言命令大全
- 学习笔记之JavaSE(38)--泛型
- 写给正在考研的你
- SpringBoot集成mybatis