neuq.oj 1016

1016: Roliygu and Yilan

题目描述:
Roliygu is famous because he likes to play games. Today he puts a chessboard in the desktop,and plays a game with Yilan. The size of the chessboard is n by n. A stone is placed in a corner square. They play alternatively with Roliygu having the first move. Each time,player is allowed to move the stone to an unvisited neighbor square horizontally or vertically. The one who can’t make a move will lose the game. If both play perfectly, who will win the game?

输入:
The input is a sequence of positive integers each in a separate line. The integers are between 1 and 10 000,inclusive,indicating the size of the chessboard. The end of the input is indicated by a zero.

输出:
Output the winner(“Roliygu” or “Yilan”) for each input line except the last zero. No other characters should be inserted in the output.


样例输入:
2
0
样例输出:
Roliygu

#include "iostream"
using namespace std;
int main(){
    int n;
    while(cin>>n){
        if(n==0)break;
        if(n%2!=0)cout<<"Yilan"<<endl;
        else cout<<"Roliygu"<<endl;
    }
    return 0;
}

找规律

猜你喜欢

转载自blog.csdn.net/stupid_dernier/article/details/80630980
今日推荐