找规律,先弄几组N小一点的数组测试下就能发现,当N>48之后,所有的点都可达,当N<=48时,分别BFS下把不可达的点标记下就行,预处理之后就能根据输入直接输出答案了
#include<cstdio>
#include<deque>
#include<cstring>
using namespace std;
namespace
{
deque<pair<int, int> > Q;
bool flag[50][50];
void bfs(int N)
{
int now, step;
memset(flag[N], 0, sizeof(flag[N]));
Q.clear();
Q.push_back(make_pair(1, 3));
while (!Q.empty())
{
now = Q.front().first;
step = Q.front().second;
flag[N][now] = true;
Q.pop_front();
if (now - step > 0)
Q.push_back(make_pair(now - step, step + 2));
if (now + step <= N)
Q.push_back(make_pair(now + step, step + 2));
}
}
}
int main()
{
for (int i = 1; i <= 48; i++)
bfs(i);
int N, M;
while (scanf("%d %d", &N, &M), N || M)
puts(N <= 48 && !flag[N][M] ? "Don't make fun of me!" : "Let me try!");
return 0;
}