(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");}}}}
- (1.1.8)UVA 10120 Gift?!(模拟题)
- UVA 10120 - Gift?!
- UVA 10120 - Gift?!(搜索+规律)
- uva 10120 - Gift?!(规律+bfs)
- uva 10120——Gift?!
- UVA - 10120 Gift?! 暴力+规律
- 【USACO-Chapter1-1.1】【模拟】Greedy Gift Givers
- USACO--1.1Greedy Gift Givers+模拟
- USACO 1.1.2 - Greedy Gift Givers(模拟)
- UVA Greedy Gift Givers
- UVA 10417 Gift Exchanging
- UVA 10417 - Gift Exchanging
- UVa 10417 - Gift Exchanging
- CodeForcess--609B--The Best Gift(模拟水题)
- 10120 - Gift!
- UVA 119.Greedy Gift Givers
- UVa 10889 - The Lost Gift
- UVa 119 - Greedy Gift Givers
- SEO学习必看:影响SEO排名的八大因素详解
- Linux相关
- python取文件路径
- ITK VTK CTK QT 跨平台联合开发之 三 <Mac OS X篇>
- 遍历文件、子目录
- (1.1.8)UVA 10120 Gift?!(模拟题)
- Hadoop 相关
- JAVA 框架
- 中国象棋程序的设计与实现(六)--N皇后问题的算法设计与实现(源码+注释+截图)
- java js 日期
- 软件流程
- 剑指offer---3
- 设计数据库基本理念
- 如何设置远程启动