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. X-MAS CTF 2018 - Crypto - Hanukkah

    参考链接 https://ctftime.org/task/7321 https://github.com/VoidHack/write-ups/tree/master/X-MAS%20CTF%202 ...

  2. 文本框的SelectionDirection属性

    代码实例: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...

  3. jsp基础模板

    jsp页面基础模板 base.jsp <%@ page language="java" contentType="text/html; charset=UTF-8& ...

  4. Python比较两个excel文档内容的异同

    #-*- coding: utf-8 -*- #比对两个Excel文件内容的差异#---------------------假设条件----------------#1.源表和目标表格式一致#2.不存 ...

  5. Flask学习笔记02之配置文件

    1. Flask默认的配置 Flask实例中包含了它的配置信息 #实例化一个Flask对象 app = Flask(__name__) # 打印默认配置信息 print(app.config) 打印结 ...

  6. OC + RAC (八) 查看信号状态和跳过信号

    -(void)_test9{ /// RACCommand又叫命令 是用来收发数据的 监听按钮点击,网络请求.... RACCommand * command = [[RACCommand alloc ...

  7. Word文档粘贴到DEDECMS

    Chrome+IE默认支持粘贴剪切板中的图片,但是我要发布的文章存在word里面,图片多达数十张,我总不能一张一张复制吧?Chrome高版本提供了可以将单张图片转换在BASE64字符串的功能.但是无法 ...

  8. [STL]lower_bound&upper_bound

    源码 lower_bound template <class ForwardIterator, class T> ForwardIterator lower_bound (ForwardI ...

  9. [HG]奋斗赛M

    题A     请进入链接↑ 题B     请进入链接↑ 题C     请进入链接↑ 题D     请进入链接↑ 题E     请进入链接↑ 题F     懒得写了,借用一下Chtholly_Tree巨 ...

  10. Eclipse安装STS插件两种方式

    spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置.通过 ...