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. 10.Linux-CentOS系统重启之后Xshell无法SSH连接(云环境)

    问题:云环境下CentOS系统断电或强制关机,再开机出现问题:Entering emergency mode. Exit the shell to continue. Generating " ...

  2. rabbitmq tags

    #用户角色####################### RabbitMQ的用户角色分类:none.management.policymaker.monitoring.administrator Ra ...

  3. Linux下python pip手动安装笔记

    今天查问题, 从redis集群中模糊查询某个key, 用一些重复的命令, 链接不同的node, redis-cli 去查, 感觉不舒服. 考虑写一些shell或py来简化一下. 一查环境, 安装了py ...

  4. 如何搭建一个spring boot项目

    什么是springboot? Spring Boot俗称微服务.Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了特 ...

  5. MyCAT操作MySQL示例之E-R表

    接着上一篇继续..... E-R 关系的数据分片策略,子表的记录与所关联的父表记录存放在同一个数据分片上,即子表依赖于父表,通过表分组(Table Group)保证数据 Join 不会跨库操作. 表分 ...

  6. sublime px转rem插件

    http://www.cnblogs.com/phoebewang00/p/5593699.html lime 插件- px 转rem   一个CSS的px值转rem值的Sublime Text 3自 ...

  7. Linux学习篇(二)-软件包管理器、Yum 软件仓库

    红帽软件包管理器 在红帽软件包管理器(rpm)公布之前,Linux 系统软件的安装只能采取"源码包"的方式安装,需要自行编译源码并解决许多依赖关系,所以软件的安装.升级.卸载的难度 ...

  8. Java常用工具——java多线程

    一.线程的创建 方式一:继承Thread类,重写run()方法 package com.imooc.thread1; class MyThread extends Thread{ public MyT ...

  9. pycharm项目代码上传远程centos服务器

    pycharm项目代码上传远程centos服务器 在工作中,我们经常会遇到如下情况,在windows系统下的pycharm中开发项目,但是需要在linux服务器上部署和运行我们的项目.那么我们的项目是 ...

  10. ICPC2019上海区域赛 部分题解(正在更新)

    K. Color Graph 题意: 给定一个简单图,点个数<=16,删去部分边后,使得该图中无边数为奇数得环,问剩下的边数最大为多少? 思路: 如果一个图中无奇数边的环,那么这个图一定是个二分 ...