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. 常用Linux Shell命令组合

    序号 任务 命令组合 1 删除0字节文件 find . -type f -size 0 -exec rm -rf {} \;find . type f -size 0 -delete 2 查看进程,按 ...

  2. Nginx 的总结

    目录 Nginx 的产生 Nginx 的用武之地 Web 服务器对比 Nginx 的产生 Nginx 同 Apache 一样都是一种 Web 服务器.基于 REST 架构风格,以统一资源描述符(Uni ...

  3. alert(1) to win 9

    function escape(s) { function htmlEscape(s) { return s.replace(/./g, function(x) { return { '<': ...

  4. 01.python对象

    标准类型 数字 Integer 整型 Boolean 布尔型 Long integer 长整型 (python2) Floating point real number 浮点型 Complex num ...

  5. Qt 倒计时验证码按钮效果

    本来还想继承QTimer跟QPushButton去实现,后来发现可以使用两个QTimer来实现: 验证码倒计时间:(60s) 封装到widget类里: 需要这几个数据:Button,TimerA,Ti ...

  6. 关于memset

    memset填充的是一个字节,比方下面的一段程序: #include <cstdio> #include <cstring> using namespace std; ]; i ...

  7. linux运维、架构之路-Zabbix自动化

    一.Zabbix自定义监控 web01客户端修改/etc/zabbix/zabbix_agentd.conf [root@m01 tools]# echo "UserParameter=lo ...

  8. mysql版本

    $ mysql Welcome to the MariaDB monitor.  Commands end with ; or \g. Your MySQL connection id is 4791 ...

  9. 【HDOJ6695】Welcome Party(multiset)

    题意: n<=1e5,x[i],y[i]<=1e18 思路: #include<bits/stdc++.h> using namespace std; typedef long ...

  10. PHP获取时间排除周六、周日的两个方法

    //方法一: <?php $now = time(); //指定日期用法 $now = strtotime('2014-01-08') ; $day = 3600*24; $total = 12 ...