游客 Signup | Login
中文 | En

2270 - 2013_12_13_C

MiaoMiao跟WangWang在玩一个硬币摆放的游戏,规则是:从n个硬币中轮流拿若干不超过m的硬币,MiaoMiao先手,拿到最后一枚硬币的为winner

Input

多组数据,输出到文件末尾结束

每组数据输入n,m (1<n,m<100)

Output

每组数据输出winner

Examples

Input

6 2
4 2
3 1

Output

WangWang
MiaoMiao
MiaoMiao

Solution C++

#include <iostream>
using namespace std;
int main()
{
	int T=0,i=0,n=0,m=0,p=0;
	while(cin>>n>>m)
	{
		if(n%(m+1)==0)
			cout<<"WangWang"<<endl;
			else
			cout<<"MiaoMiao"<<endl;
	}

	return 0;
}
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题