列表

详情


NC15826. chess

描述

A single chess queen is placed somewhere on a  grid of 10000*10000 squares.Lao Wang and Xiao Ren ready to play a game The rules are player can move the queen towards the lower left corner of the grid: south, west, or southwest, any number of steps. The winner is the player who moves the queen into the southwest corner.If you let the old Xiao Ren first chess .Suppose they will use the best strategy who will win the game?

输入描述

The input will consist of a series of pairs of integers a and b, Indicates the distance from the west boundary and the distance from the south boundary.

输出描述

For each pair of input integers a and b you should output the winner's name in one line;

示例1

输入:

1 2
3 5
1 1
3 2

输出:

Lao Wang
Lao Wang
Xiao Ren
Xiao Ren

原站题解

上次编辑到这里,代码来自缓存 点击恢复默认模板

C++ 解法, 执行用时: 456ms, 内存消耗: 2620K, 提交时间: 2022-03-09 16:40:27

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    while(cin>>a>>b)
    cout<<((int)(((sqrt(5)+1)/2)*(max(a,b)-min(a,b)))==min(a,b) ? "Lao Wang":"Xiao Ren")<<endl;
    return 0;
}

上一题