acm freshman season -who is better

 

1441: who is better

Time limit: 1 Sec   memory limit: 128 MB
submitted: 51   Resolution: 6
[ Submit ] [ state ] [ discussion Edition ]

Title Description

There are a total of N bunch of stones. syx xxh two people take turns, syx acquire. Every time take a minimum, take the most K stars, got the last one stone man win. syx xxh are very smart, the process will not take stones mistakes. Given N and K, and asked who won the last race. For example N = 3, K = 2. Regardless of syx take, xxh can get the last one stone.
 

Entry

Line 1: a number T, the number indicates the number of tests later used as an input. (1 <= T <= 10000) of 2 - T + 1 rows: 2 per row number N, K. Separated by a space. (1 <= N, K <= 10 ^ 9)
 

Export

T total line, if syx wins output syxnb, if xxh winning output xxhnb.
 

Sample input

4
3 2
4 2
7 3
8 3

Sample Output

xxhnb 
syxnb 
syxnb 
xxhnb 

Solution: Bash Game only.
code show as below

#include<iostream>
using namespace std;
main()
{
int t,n,k,i,j;
cin>>t;
for(i=0;i<t;i++)
{
cin>>n>>k;
if (n%(k+1)==0)
cout <<"xxhnb"<<endl;
if (n%(k+1)!=0)
cout <<"syxnb"<<endl;
}
return 0;
}

Guess you like

Origin www.cnblogs.com/false0/p/11616508.html