问题
https://vjudge.net/problem/UVA-10120
分析
第一想法是模拟,但是会超时,随后想到找规律,但是太菜了,找不出来。
参考:https://www.cnblogs.com/zjbztianya/archive/2013/04/14/3019693.html
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long LL;
const int maxn=1000000+5;
int n,m;
bool dfs(int cur,int d){
if(cur==m) return true;
int len=(d<<1)-1;
if(cur-len>0 && dfs(cur-len,d+1)) return true;
if(cur+len<=n && dfs(cur+len,d+1)) return true;
return false;
}
int main(void){
while(scanf("%d%d",&n,&m)==2 && n){
if (n>=49) printf("Let me try!\n");
else if(dfs(1,2)) printf("Let me try!\n");
else printf("Don't make fun of me!\n");
}
return 0;
}