【Vijos 1655】萌萌的糖果博弈

题目传送门:https://vijos.org/p/1655

这个题嘛,暴力打印一下40以内的情况如下:
78973673526
不难发现,个位为2,3,7,8的话,则为先手必败
于是乎,读入+输出即可

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;

const int MAXN = 100000;

char s1[MAXN],s2[MAXN];
int l1,l2;

inline bool leg(int c){
	return c == 2 || c == 3 || c == 7 || c == 8;
}

int main(){
	while (scanf("%s%s",s1+1,s2+1) == 2){
		l1 = strlen(s1+1); 
		l2 = strlen(s2+1);
		if (leg(s1[l1]-'0') && leg(s2[l2]-'0')) cout<<"SheepDaddy"<<endl;
		else cout<<"MengMeng"<<endl;
	}
	return 0;
}

One thought to “【Vijos 1655】萌萌的糖果博弈”

Leave a Reply

Your email address will not be published. Required fields are marked *