当前位置:网站首页>The stones game
The stones game
2022-06-29 10:10:00 【It's mally!】
The Stones Game【 Take a stone game & thinking 】
notes
2020.7.22 Supplementary questions
Problem G. The Stones Game

The question
Yes n A stone ,m A contestant
Each player has to do 2 Step by step :
(1) Take a stone or not
(2) If the operation of the last player (1) It was a stone Or the current player is 1 Contestant No , Then you can't take a stone in this step , conversely , You have to take a stone .
" if this is not the first turn and in the previous turn the player decided not to remove a stonein his/her first step, then the current player must remove a stone in this step" This sentence is hard to understand ~, Turn it into a negative sentence ,and become or, You can get the above sentence .
Who finally takes the stone and sleeps wins , ask n A stone ,m Players go down ,y Whether it is in a must win state .
analysis
1 Contestant No (1) Bu took the stone ,(2) You can't take a stone , that 2 Contestant No (1) You can choose to take it or not , The first (2) Step can not take .
therefore 2 Players should take at least 1 A stone , At most 2 A stone 、
If there is 3 A contestant , You can also push and take the most 3 individual , At least take 2 individual .
So if there is 3 A contestant , Need to take 3 A stone , that 3 Player No. 1 is a must win .
Yes n A stone ,m When a player ,n%m Player No. 1 is a must win .
#include "bits/stdc++.h"
using namespace std;
int main()
{
int cas;
scanf("%d",&cas);
while (cas--)
{
int n,m,y;
scanf("%d %d %d",&n,&m,&y);
int k=n%m;
if(k==0)k=m;
if(y==k)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}
边栏推荐
- Dsolve function of sympy
- Flutter 基础组件之 Image
- 2019.10.20训练总结
- C语言实现一种创建易管理易维护线程的方法
- If I were in Beijing, where would it be better to open an account? In addition, is it safe to open an account online now?
- Minorgc, majorgc, fullgc
- How to traverse objects in the vector container
- KDevelop new project
- JVM之对象的内存布局
- manacher
猜你喜欢

A method of creating easy to manage and maintain thread by C language

container

Alibaba cloud firewall configuration, multiple settings (iptables and firewall)

Cisco ASA、FTD和HyperFlex HX的漏洞分析复现

C语言实现一种创建易管理易维护线程的方法

The Stones Game【取石子博弈 & 思维】

Pipeline details of IPC (interprocess communication)

IPC(进程间通信)之管道详解

JVM之虚拟机栈之动态链接

Flutter 基础组件之 GridView
随机推荐
JNI.h说明
Codeforces Round #645 (Div. 2)
如果我在北京,到哪里开户比较好?另外想问,现在在线开户安全么?
JVM之TLAB
在Activity外使用startActivity()方法报错原因与解决办法
FreeRTOS(九)——队列
Rikka with Cake(线段树+线段树)
Codeforces - 1151b thinking
2019.11.20训练总结
Database common interview questions (with answers)
Recyclerview refreshes blinks and crashes when deleting items
Application of keil5 integrated development environment for single chip microcomputer
A method of creating easy to manage and maintain thread by C language
C语言中通过sprintf()函数构造sql语句
LiferayPortal JSONWS反序列化漏洞(CVE-2020-7961)分析
FreeRTOS (IX) - queue
ImageView图片填充问题
另类实现 ScrollView 下拉头部放大
Container of the basic component of the flutter
任务调度器之Azkaban的使用