(1.1.8)UVA 10120 Gift?!(模拟题)

来源:互联网 发布:江苏运时数据电话 编辑:程序博客网 时间:2024/05/20 14:44
/* * UVA_10120.cpp * *  Created on: 2013年10月7日 *      Author: Administrator */#include <iostream>#include <cstdio>using namespace std;int n,m;bool flag ;void dfs(int pos,int val){int temp = pos - val;if(temp == m){flag = true;return ;}if(temp >= 1 && temp <= n){dfs(temp,val+2);}if(flag){return ;}temp = pos + val;if(temp == m){flag = true;return ;}if(temp >= 1 && temp <= n){dfs(temp,val+2);}if(flag){return ;}}int main(){while(scanf("%d%d",&n,&m)!=EOF,n||m){if(n >= 50){printf("Let me try!\n");}else{flag = 0;//初始化,别漏了,漏了会WA的dfs(0,1);if(flag){printf("Let me try!\n");}else{printf("Don't make fun of me!\n");}}}}