当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
随机推荐
In XML layout, the button is always displayed on the top layer
2019.10.23训练总结
Pipeline details of IPC (interprocess communication)
2020-09-21 Visual Studio头文件和库目录配置
Caused by: org.apache.xerces.impl.io.MalformedByteSequenceException: Invalid byte 3 of 3-byte UTF-8
C语言中通过sprintf()函数构造sql语句
Flutter 基础组件之 Image
Power Strings【KMP循环节】
Nacos环境隔离
Causes and solutions of error reporting by using startactivity() method outside the activity
2019-11-10训练总结
Memory layout of JVM objects
使用Rancher搭建Kubernetes集群
leetcode MYSQL数据库题目177
Flutter 基础组件之 Container
Time varying and non time varying
container
Force deduction 85 question maximum rectangle
RecyclerView 通用适配器封装
Codeforces Round #659 (Div. 2)








