zoukankan      html  css  js  c++  java
  • codeforces 493 D Vasya and Chess【 博弈 】

    题意:给出n*n的棋盘,白方在(1,1),黑方在(1,n)处,每一步可以上下左右对角线走,哪个先抓到另一个,则它获胜

    可以画一下,发现n是奇数的时候,白方先走,无论它怎么走,黑方和它走对称的,黑方都一定能赢

    n是偶数的时候,将白方走到(1,2)就变成奇数的情况,白方必胜

     1 #include<iostream>  
     2 #include<cstdio>  
     3 #include<cstring> 
     4 #include <cmath> 
     5 #include<stack>
     6 #include<vector>
     7 #include<map> 
     8 #include<set>
     9 #include<queue> 
    10 #include<algorithm>  
    11 using namespace std;
    12 
    13 typedef long long LL;
    14 const int INF = (1<<30)-1;
    15 const int mod=1000000007;
    16 const int maxn=1000005;
    17 
    18 int main(){
    19     int n;
    20     scanf("%d",&n);
    21     if(n&1) puts("black");
    22     else printf("white
    1 2
    ");
    23     return 0;
    24 }
    View Code
  • 相关阅读:
    information_schema
    面包屑路径导航
    mysql5.7.26安装
    菜单权限作为父权限
    权限控制到按钮
    二级菜单
    留言板和jq轮播图
    M商城
    表单
    w3c
  • 原文地址:https://www.cnblogs.com/wuyuewoniu/p/4607271.html
Copyright © 2011-2022 走看看