2020 Winter Holiday [gmoj1596] [GDKOI2004] [Stone Game] [Parity Judgment]

Title description

Xiaoyong and Xiaoshi are good friends, they often play together. The game they play today is this: there is a floor made of square stones, its height is 2, and its length is N. For example, the following is the case of N = 3:
Insert picture description here

Now they take turns to put rectangular stones with length and width of 1 and 2 on them, either horizontally or vertically, but they should be laid on the two uncovered square stones on the floor, when someone cannot Then he lost.
For example, a game may be like this, Xiaoshi horizontally laid stones on the top left, as follows:
Insert picture description here
Then Xiaoyong horizontally laid stones on the bottom right, as follows:
Insert picture description here

At this time, Xiao Shi could no longer put stones, so he lost. Xiaoyong is more polite, he let Xiaoshi release first. Of course, the above method may not be the best. Now if they are extremely clever, please program to determine who will win.

Input

An integer C (1 <= C <= 100) in the first line indicates the number of test data. Next there is line C, each line is a test data, each test data only has an integer N (1 <= N <= 100).

Output

Line C is output, and each line outputs the result of the corresponding test data. For each result, if Xiaoyong wins, xiaoyong is output, otherwise Xiaoshi wins, and xiaoshi is output.

Sample input

1
1

Sample output

xiaoshi

analysis

Very clever!
In fact, looking for the law, you can find that n is an odd number, which means small real wins, and even number means Xiaoyong wins
.

Code on

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int c,n;
int main()
{
    freopen("game.in","r",stdin);
	freopen("game.out","w",stdout);
	cin>>c;
	for(int i=1;i<=c;i++)
	{
		cin>>n;
		if(n%2!=0) cout<<"xiaoshi"<<endl;
		else if(n%2==0) cout<<"xiaoyong"<<endl;
	}
	fclose(stdin);
	fclose(stdout); 
    return 0;
}

Published 110 original articles · won 100 · visited 8015

Guess you like

Origin blog.csdn.net/dglyr/article/details/105057148