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

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

RecyclerView 通用适配器封装

另类实现 ScrollView 下拉头部放大

The collapsing "2.3 * 10 = 22" produced by multiplying float and int

Codeforces Round #645 (Div. 2)

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

使用Rancher搭建Kubernetes集群

Force deduction 85 question maximum rectangle

C语言中通过sprintf()函数构造sql语句

A 3D Dual Path U-Net of Cancer Segmentation Based on MRI
随机推荐
Leetcode MySQL database topic 177
leetcode MYSQL数据库题目178
Fully Automated Gross Tumor Volume Delineation From PET in Head and Neck Cancer Using Deep Learning
2019.10.30学习总结
Leetcode MySQL database topic 181
JVM四种调用方法的指令
数据库常见面试题(附答案)
语言特性
如果我在北京,到哪里开户比较好?另外想问,现在在线开户安全么?
Automatic Multi-Organ SegmVentation on Abdominal CT With Dense V-Networks
Force deduction 85 question maximum rectangle
gSoap例子——calc
自定义控件之侧滑关闭 Activity 控件
2020-09-21 referer字符串切分 boost gateway代码组织层次
Codeforces Round #652 (Div. 2)
Flutter 基础组件之 ListView
Time varying and non time varying
时变和非时变
FreeRTOS(八)——时间管理
ImageView picture fill problem