1016: Roliygu and Yilan

时间限制: 1 Sec   内存限制: 128 MB
提交: 73   解决: 40
[ 提交][ 状态][ 讨论版]

题目描述

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?

棋盘大小为n*n,棋子置于棋盘一角,Roliygu先走,每次玩家允许沿水平或竖直方向邻近方格走一格,无法移动者失败。

输入

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.

输入为介于1—1000的正整数。输出以0为结束标志。

输出

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&&n!=0)
{
if((n*n-1)%2==0)
{
cout<<"Yilan"<<endl;
}

else

{
cout<<"Roliygu"<<endl;
}
    }
return 0;
}

体会:

找规律:(n*n-1)%2==0后者胜,否则先者胜。

neuq oj 1016 Roliygu and Yilan C++相关推荐

  1. #1016 Roliygu and Yilan 参考代码

    #1016 Roliygu and Yilan 题目描述 Roliygu is famous because he likes to play games. Today he puts a chess ...

  2. 1016: Roliygu and Yilan

    题目描述: Roliygu is famous because he likes to play games. Today he puts a chessboard in the desktop,an ...

  3. Buct oj 1016

    #include<stdio.h> int main() {     int a,b,c,i;     for(i=100;i<=999;i++)     {         a=i ...

  4. neuq oj 1034: C基础-求同存异 C++

    1034: C基础-求同存异 时间限制: 1 Sec   内存限制: 128 MB 提交: 173   解决: 96 [ 提交][ 状态][ 讨论版] 题目描述 输入两个数组(数组元素个数6和8),输 ...

  5. zzuli oj 1016:银行利率(java)

    题目描述 设银行1年期定期存款年利率为2.25%,存款本金为capital元,试编程计算并输出n年后的本利之和. (注: 目前银行活期存款的利息是按单利计息的.如果是定期存款,连本带息转入下一个存期, ...

  6. zzuli OJ 1016: 银行利率

    Description 设行1年期定期存款年利率为2.25%,存款本金为deposit元,试编程计算并输出n年后的本利之和. Input 输入一个正整数和一个实数,分别代表存款年数和存款本金. Out ...

  7. 「题目代码」P1013~P1017(Java)

    1013 C基础-求偶数和 import java.util.*; import java.io.*; import java.math.BigInteger;public class Main {p ...

  8. 第五届“图灵杯”NEUQ-ACM程序设计个人赛真题重现

    文章目录 前言 系列文章目录 一.逃出生天 题目描述 分析 AC代码如下: 二.我爱数学 题目描述 AC代码如下: 三.PJ的情书 题目描述 分析 AC代码如下: 四.Harry Potter And ...

  9. gpt2_gpt 3,一开始是单词2 2

    gpt2 30秒摘要(30-Second Summary) Any innovative AI technology has its share of advantages and threats. ...

最新文章

  1. Algs4-1.1.13编写一段代码,打印出一个M行N列的二维数组的转置(交换行和列)
  2. drugbank下载XML文件解析
  3. 干货 | 请收下这份2018学习清单:150个最好的机器学习,NLP和Python教程
  4. 当超级智能崛起时……
  5. Google I/O 2019上提及的Javascript新特性
  6. 我的新浪微博,顺便总结下近况
  7. mysql中usage是什么权限?
  8. python输出数据到excel-Python从数据库导出数据到Excel
  9. Linux下的qt5.7Qftp类,[翻译] Qt QFtp功能无法被Qt 5 Network系列模块替代的说明
  10. mybatis注解开发使用二级缓存
  11. 模仿JavaAppArguments.java示例
  12. tomcat的class加载的优先顺序
  13. 技术动态 | 知识图谱从哪里来:实体关系抽取的现状与未来
  14. 电商海报模板|psd分层海报素材轻松教你凸显你的主体产品!
  15. 12. No More MVC
  16. linux下select/poll/epoll机制的比较
  17. 保护隐私型浏览器Tor发布安卓试用版
  18. 如何找到近期要召开的国际上所有的学术会议
  19. Alphapose_pytorch版本环境配置Win10
  20. 分水岭算法的理解和应用

热门文章

  1. 静态时序分析—set_clock_groups
  2. [RK3288][Android6.0] 移植笔记 --- Camera IC OV5640添加
  3. 跟着江南一点雨学习Spring
  4. 网络公开数据集调查(着重医学类)
  5. JavaScript 异常处理及异常收集
  6. C语言游戏开发——打飞机游戏2.0
  7. STM32-快速上手DAC
  8. 在tomcat下配置mysql的数据库连接池及Servlet
  9. 移植微雪例程-2.6寸双色墨水屏到ESP32IDF中
  10. wget安装,wget: 无法解析主机地址