II play with GG
2024-09-05 22:02:47
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
最新文章
- 首师大附中互测题:50136142WXY的坑爹百度地图【B006】(可以喝的超大桶水)
- oracle 修改字段类型的方法(转)
- ZeroR-baseline分类器
- 基于bootstrap的datatable控件
- ssh localhost无密码登录设置
- Neo4j安装后的密码修改
- Java关于static的作用
- jenkins定位GitLab推送的最新Webhook中push event来自哪一个分支
- 在思科路由器上配置AAA实验(Cisco PT)
- 基于struts2、hibernate、spring、shiro、MySQL的项目开发
- linq转载
- SPARKR,对RDD操作的介绍
- 如何配置Linux系统防火墙,以防止DDOS攻击?
- 红帽子系统链接加vm15秘钥一份
- CentOS7系列--2.1CentOS7中安装配置NTP服务
- hadoop11----socket
- USACO Section2.3 Money Systems 解题报告 【icedream61】
- Java丨JDK与JRE
- 简单数据结构题(from 钟子谦——IOI2018集训队自选题)
- go语言结构体作为函数参数,采用的是值传递
热门文章
- SSM架构 (Spring 5.0.2)添加Jackson
- nginx+flask+gevent+uwsgi实现websocket
- PHP: thinkPHP踩坑记录(实现API接口以及处理莫名其妙的500问题)
- shell 数组中 @ 跟 * 的区别
- 外媒:Apple面临着印度iPhone的停用
- macOS BLAS LAPACK
- 笔记-CSS-e:nth-chid
- Activiti介绍(一)
- selenium来识别数字验证码
- 代理池抓取基础版-(python协程)--抓取网站(西刺-后期会持续更新)