https://ac.nowcoder.com/acm/contest/338/I

题解:首先轮到出手的时候如果在(0,0)上肯定是输的,而(0,1)(1,0)(0,2)(2,0)(1,1)肯定是赢的;

往上递推,某一个(x,y)如果可以走的(x-1,y)(x,y-1)(x-1,y-1)三点都是必输的,那么在(x,y)的人必输。

借大佬代码一用

#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N=1000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
int t,n,m,k,q,ans;
bool a[N][N];
char str;
int main()
{
#ifdef DEBUG
freopen("input.in", "r", stdin);
//freopen("output.out", "w", stdout);
#endif
scanf("%d%d",&n,&m);
a[0][0]=0;
a[1][0]=a[0][1]=1;
a[1][1]=1;
for(int i=0; i<=n; i++)
{
for(int j=0; j<=m; j++)
{
if(i-1>=0&&j-1>=0)
{
if(a[i][j-1]&&a[i-1][j]&&a[i-1][j-1])
a[i][j]=0;
else
a[i][j]=1;
}
else if(i-1>=0)
{
if(a[i-1][j])
a[i][j]=0;
else
a[i][j]=1;
}
else if(j-1>=0)
{
if(a[i][j-1])
a[i][j]=0;
else
a[i][j]=1;
}
} } if(a[n][m])
{
cout << "ii" << endl;
}
else
{
cout << "gg" << endl;
}
//cout << "Hello world!" << endl;
return 0;
}

待补充

#include<bits/stdc++.h>
using namespace std;
int main(){
int m,n;
cin >> m >>n;
if(min(m,n)%2) cout <<"ii";
else if ((max(m,n)-min(m,n))%2==0) cout <<"gg";
else cout <<"ii"; return 0;
}

当 全为奇数则 ii,反之gg

II play with GG的更多相关文章

  1. 湖南大学第十四届ACM程序设计新生杯(重现赛)I:II play with GG(博弈论||DP)

    链接:https://ac.nowcoder.com/acm/contest/338/I 来源:牛客网 题目描述 IG won the S championship and many people a ...

  2. II play with GG(思维规律)

    时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 IG won the S champion ...

  3. Windows Phone 8 MD5

    using System; using System.Net; using System.Windows; using System.Windows.Controls; using System.Wi ...

  4. Java基础-Java数据类型

    Java基础-Java数据类型 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.数据类型的作用 数据类型就是一组值,以及这一组值上的操作,数据类型可以决定数据的存储方式,取值范围 ...

  5. AtCoder | ARC102 | 瞎讲报告

    目录 ARC102 前言 正文 传送链接~ ARC102 前言 实在是太菜了....写完第一题就弃疗..感觉T3好歹也是道可做题吧!!然后T2怎么又是进制拆分! 正文 A 题意 给你两个数字\(n,k ...

  6. cdoj1588 潘爷泡妹

    地址:http://acm.uestc.edu.cn/#/problem/show/1588 题目:复制过来发现有问题,自己去cdoj看吧 思路: 1.先进行多次spfa跑出所有人之间的相互到达所需要 ...

  7. A* k短路 学习笔记

    题目大意 n个点,m条边有向图,给定S,T,求不严格k短路 n<=1000 m<=100000 k<=1000 不用LL 分析 A*算法 f(i)表示从S出发经过i到T的估价函数 \ ...

  8. Web scraping with Python (part II) « Jean, aka Sig(gg)

    Web scraping with Python (part II) « Jean, aka Sig(gg) Web scraping with Python (part II)

  9. 【LGR-054】洛谷10月月赛II

    [LGR-054]洛谷10月月赛II luogu 成功咕掉Codeforces Round #517的后果就是,我\(\mbox{T4}\)依旧没有写出来.\(\mbox{GG}\) . 浏览器 \( ...

随机推荐

  1. Codeforces Round #421 (Div. 2) - B

    题目链接:http://codeforces.com/contest/820/problem/B 题意:给定一个正n边形,然后让你选择3个不同的顶点,使得这3个顶点形成的角度尽可能的接近a. 思路:首 ...

  2. 树——minimum-depth-of-binary-tree(二叉树的最小深度)

    问题: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the s ...

  3. poj 2689 Prime Distance(区间筛选素数)

    Prime Distance Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9944   Accepted: 2677 De ...

  4. rabbit-c编译 vs2013

    需要openssl的库

  5. 记录一次 Linux crontab 执行django 脚本 失败 的经历和解决办法

    目的是想通过定时任务来执行一次数据统计,本来可以用celery来做,但是想着这个项目整个就没用到异步的地方,所以决定用crontab来做.之前做过数据库的热备份,想来用该没啥问题,但是现实打脸啪啪响. ...

  6. java selenium常用API汇总

    (WebElement.iFrame.select.alert.浏览器窗口.事件.js)     一 WebElement相关方法 1.点击操作 WebElement button = driver. ...

  7. AGC036C GP 2

    由于近期集训做的一直都是校内题 然后好久都怎么写题了( 发篇博客证明我还活着 (其实也没人关心 好像并不是很难的一道计数 就是脑子总是缺一块导致会做不出来( 首先我们可以分析性质 1.$\sum A_ ...

  8. 关于python读写文件的r+方式的坑

    写脚本的时候需要将文件中的一行修改,我的修改逻辑是,用r+方式打开文件,然后将原文件数据读入一个数组,修改数组的对应元素,在seek(0),然后将数组write进文件 结果: 文件文件末尾总是多出一行 ...

  9. Centos7.5中的SElinux操作命令说明

    设置Selinux模式 setenforce 0 0表示警告模式 1表示强制模式 关闭要设置/etc/sysconfig/selinux下将"SELINUX=enforcing"改 ...

  10. Eclipse中安装和使用FindBugs

    FindBugs在Eclipse的离线安装:   1 到http://findbugs.sourceforge.net/downloads.html下载20131115123549_nlpir_ict ...