当前位置:网站首页>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;
}
边栏推荐
猜你喜欢

另类实现 ScrollView 下拉头部放大

FreeRTOS (IX) - queue

Perfect binary tree, complete binary tree, perfect binary tree

float 与 int 相乘产生的令人崩溃的“ 2.3 * 10 = 22 ”

Codeforces Round #659 (Div. 2)

2021年团体程序设计天梯赛-模拟赛

基辅周边的凄美废墟——切尔诺贝利的安全前往指南!

Application of keil5 integrated development environment for single chip microcomputer

How to traverse objects in the vector container

EDA and VHDL question bank
随机推荐
2019.10.23训练总结
2020-09-17 gateway业务流程 两个任务:referer认证和非商品模板化
共用体Union
SymPy Tutorial(译)
Leetcode MySQL database topic 181
Setinterval, setTimeout and requestanimationframe
leetcode MYSQL数据库题目178
Memory layout of JVM objects
EDA与VHDL题库
TLAB of JVM
2019.11.20训练总结
Leetcode MySQL database topic 176
Pipeline details of IPC (interprocess communication)
RecyclerView刷新闪烁与删除Item时崩溃问题
JVM method return address
自定义控件之下载控件1(DownloadView1)
力扣94二叉树的中序遍历
单片机集成开发环境Keil5的使用
Flutter 基础组件之 Image
2019icpc上海区域赛赛后总结