Codeforces 493D Vasya and Chess 题解
来源:互联网 发布:怎么下载wps软件 编辑:程序博客网 时间:2024/05/17 05:01
题意
给一个n*n的棋盘,白棋在左上角,黑棋在右上角,其他格子都放了绿色棋子,每一次移动只能向8联通方向移动而且必须吃掉一个棋子,白棋先走,问最后谁赢
思路
考虑对称性,后手永远可以跟着先手对称走子,所以如果n为奇数,后手必胜,如果n为偶数,白棋第一步只需右移一格就转变成了n为偶数的情况,所以这么走白棋必胜
代码
#include <cstdio>int main(){ int n; scanf("%d",&n); if(n%2==0) { printf("white\n"); printf("1 2\n"); } else printf("black\n"); return 0;}
0 0
- Codeforces 493D Vasya and Chess 题解
- Vasya and Chess - CodeForces 493 D 博弈
- 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
- D. Vasya and Chess
- 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
- Codeforces Round #281 (Div. 2)D. Vasya and Chess(博弈,想法题)
- Vasya and Chess
- 【29.89%】【codeforces 734D】Anton and Chess
- CodeForces 734D Anton and Chess 【模拟】
- Codeforces 734D Anton and Chess
- Codeforces D. Anton and Chess By Assassin
- 【Codeforces 734 D Anton and Chess】
- Executor 概述
- 51nod 1013 3的幂的和(快速幂+逆元)
- JavaScript原生Array常用方法
- NSThread
- DFS(深搜)算法解析
- Codeforces 493D Vasya and Chess 题解
- Dell Dock 无法启动解决办法
- centos6 关于 ssh,svn,tomcat远程不能访问的问题处理过程
- 1037. 在霍格沃茨找零钱
- GCD之信号量机制二
- GCD之信号量机制一
- Ubuntu 14.04下怎么使用chroot创建另外一个系统
- Coursera ML笔记 -----week8-2 数据降维
- 101097B-思维,vector的resize和assign