hdu 1049 Climbing Worm】的更多相关文章

解题思路: 1. 两种情况,0x1:井深度小于一次跳的高度.0x2:井深度大于一次跳的高度 2.如果 属于 0x1 则一次跳出 3.否则 本次解题中直接枚举跳的次数 一直循环,直到 [每次跳的真实高度(一次高度减去滑下的高度)]*[次数(循环)]+[最后一次(一次的高度)]大于等于井深度 得到次数 4. 输出:次数*2+1 次数*2:每跳一次,休息一分钟 +1   :最后一跳,直接跳出井 Ac code: #include<stdio.h> int main(void) { int n,u,d…
Climbing Worm Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10217    Accepted Submission(s): 6761 Problem Description An inch worm is at the bottom of a well n inches deep. It has enough energ…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1049 以 上升-下降 一次为一个周期,一个周期时间为2分钟,每个周期上升距离为(u-d).先只考虑上升,再只考虑下降.先上升n/u次,再下降n/u次,这样保证不会超过井口,这样上升和下降各n/u次之后离井口距离为 n-(u-d)*(n/u),用时n/u分钟.最后一定会出现这样的情况,离井口的距离<=u,这样,一次上升即可到达井口,用时1分钟(题目说明了不足一分钟按照一分钟算).可以用递归和循环两种方式实…
Climbing the Hill Time Limit: 1000MS   Memory Limit: 32768KB   64bit IO Format: %I64d & %I64u Submit Status Description Alice and Bob are playing a game called "Climbing the Hill". The game board consists of cells arranged vertically, as the…
Climbing the Hill Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 919    Accepted Submission(s): 411 Problem Description Alice and Bob are playing a game called "Climbing the Hill". The ga…
http://acm.hdu.edu.cn/showproblem.php?pid=4315 题意:由上至下有多个格子,最顶端的是山顶,有多个球,其中有一个球是king,每次可以将球向上移动任意个格子,但是不可以跨越别的球.现将king移动到山顶者赢. 思路:和poj1704是差不多的,如果不懂阶梯博弈的话,可以看看我的这篇博客http://www.cnblogs.com/zyb993963526/p/7868315.html. 现在还是两两分组,谁没空格可移肯定是必败状态,为什么呢?首先,如果…
Winston the Worm just woke up in a fresh rectangular patch of earth. The rectangular patch is divided into cells, and each cell contains either food or a rock. Winston wanders aimlessly for a while until he gets hungry; then he immediately eats the f…
参考博客 先讲一下Georgia and Bob: 题意: 给你一排球的位置(全部在x轴上操作),你要把他们都移动到0位置,每次至少走一步且不能超过他前面(下标小)的那个球,谁不能操作谁就输了 题解: 当n为偶数的时候,假设当每个球都相互挨着没有间隙,那么两两一组,一组中前面那个走到哪,后面那个跟上就可以了,先手必输 如果球与球之间有间隙,那么俩俩球之间的距离可以当作尼姆博弈中取石子游戏中一堆石子的石子数,用尼姆博弈判断一下就可以了 可以说先手赢不赢光和两球之间的距离有关,如果俩俩球之间的的距离…
题意:有n个人爬山,山顶坐标为0,其他人按升序给出,不同的坐标只能容纳一个人(山顶不限),Alice和Bob轮流选择一个人让他移动任意步,但不能越过前面的人,且不能和前面一个人在相同的位置.现在有一个人是king,给出king是哪个人(id),谁能将国王移动到山顶谁胜. 解题思路:先考虑简化版,没有king,谁先不能移动谁输掉.和阶梯博弈类似http://blog.csdn.net/longshuai0821/article/details/7793043.根据人数的奇偶性:把人从上顶向下的位置…
传送门 题意: 和上题基本一样:山顶可以有多人,谁先把king放到山顶谁就胜 并不太明白 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std; typedef long long ll; ; inline int read(){ ,f=; ;c=getchar();} +…
题意是一只虫子在深度为 n 的井中,每分钟向上爬 u 单位,下一分钟会下滑 d 单位,问几分钟能爬出井. 本人是直接模拟的,这篇博客的分析比较好一些,应当学习这种分析问题的思路:http://www.cnblogs.com/A--Q/p/5719353.html 代码如下: #include <bits/stdc++.h> using namespace std; int main() { int n,u,d,pos,ans; while(~scanf("%d%d%d",&…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=494 题目大意: 一只蜗牛要从爬上n英寸高的地方,他速度为u每分钟,他爬完u需要休息1分钟,且他休息时下滑d英寸,问他什么时候爬出去. 吐槽: 小学的数学题编程了编程题,简直丧心病狂. 思路: 数据量小直接模拟即可. 也可以用数学推导 模拟板: #include<cstdio> int main() { int n,u,d; while(~scanf("%d%d%d…
HDU 1000 A + B Problem  I/O HDU 1001 Sum Problem  数学 HDU 1002 A + B Problem II  高精度加法 HDU 1003 Maxsum  贪心 HDU 1004 Let the Balloon Rise  字典树,map HDU 1005 Number Sequence  求数列循环节 HDU 1007 Quoit Design  最近点对 HDU 1008 Elevator  模拟 HDU 1010 Tempter of th…
Climbing Worm Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19841    Accepted Submission(s): 13532 Problem Description An inch worm is at the bottom of a well n inches deep. It has enough ene…
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029. 1032.1037.1040.1048.1056.1058.1061.1070.1076.1089.1090.1091.1092.1093. 1094.1095.1096.1097.1098.1106.1108.1157.116…
Climbing Worm Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9964    Accepted Submission(s): 6553 Problem Description An inch worm is at the bottom of a well n inches deep. It has enough energy…
section 1 不解释~ section 2 1.2.1 a+b coming #include<stdio.h> long long z,x,y; int main( ) { while( scanf( "%I64x%I64x",&x,&y ) != EOF ) { z = x + y; ) printf( "-" ), z = -z; printf( "%d\n",z ); } ; } 1.2.2 Climbi…
杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze 广度搜索1006 Redraiment猜想 数论:容斥定理1007 童年生活二三事 递推题1008 University 简单hash1009 目标柏林 简单模拟题1010 Rails 模拟题(堆栈)1011 Box of Bricks 简单题1012 IMMEDIATE DECODABILITY…
acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  1024   Calendar Game       简单题  1027   Human Gene Functions   简单题  1037   Gridland            简单题  1052   Algernon s Noxious Emissions 简单题  1409   Commun…
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight Moves1101 Gamblers1204 Additive equations 1221 Risk1230 Legendary Pokemon1249 Pushing Boxes 1364 Machine Schedule1368 BOAT1406 Jungle Roads1411 Annive…
Climbing Worm Time Limit: 2 Seconds      Memory Limit:65536 KB An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. During the rest, it slips…
Climbing Worm Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 10528    Accepted Submission(s): 6970 Problem Description An inch worm is at the bottom of a well n inches deep. It has enough ener…
Worm Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3895 Accepted Submission(s): 2518 Problem Description 自从见识了平安夜苹果的涨价后,Lele就在他家门口水平种了一排苹果树,共有N棵. 突然Lele发现在左起第P棵树上(从1开始计数)有一条毛毛虫.为了看到毛毛虫变蝴蝶的过程,Lel…
Xiao Ming climbing Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=629&pid=1002 Description 小明因为受到大魔王的诅咒,被困到了一座荒无人烟的山上并无法脱离.这座山很奇怪: 这座山的底面是矩形的,而且矩形的每一小块都有一个特定的坐标(x,y)(x,y)和一个高度HH. 为了逃离这座…
http://acm.hdu.edu.cn/showproblem.php?pid=2151 Worm Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3403    Accepted Submission(s): 2194 Problem Description 自从见识了平安夜苹果的涨价后,Lele就在他家门口水平种了一排苹果树,共有…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5433 Xiao Ming climbing Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1346    Accepted Submission(s): 384 Problem Description Due to the curse m…
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1286 Accepted Submission(s): 585 Problem Description Alice and Bob are playing a game called "Climbing the Hill". The game board consists of ce…
http://acm.hdu.edu.cn/showproblem.php?pid=4315 题意:有n个人要往坐标为0的地方移动,他们分别有一个位置a[i],其中最靠近0的第k个人是king,移动的时候在后面的人不能越过前面的人,先把king送到0的人胜. 思路:阶梯博弈.把n个人两两配对,形成一个组,即a[i]和a[i+1]是一个组,a[i+2]和a[i+3]是一个组,把a[i]和a[i+1]的距离当成阶梯博弈中的奇数阶的值,a[i+1]和a[i+2]的距离当成偶数阶(不用考虑).首先k=1…
Worm Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2637    Accepted Submission(s): 1707 Problem Description 自从见识了平安夜苹果的涨价后,Lele就在他家门口水平种了一排苹果树,共有N棵. 突然Lele发现在左起第P棵树上(从1开始计数)有一条毛毛虫.为了看到毛毛虫变蝴蝶的过…
题意:给一张地图,给出起点和终点,每移动一步消耗体力abs(h1 - h2) / k的体力,k为当前斗志,然后消耗1斗志,要求到终点时斗志大于0,最少消耗多少体力. 解法:bfs.可以直接bfs,用dp维护最小值……也可以用优先队列优化……但是不能找到终点后就直接输出,因为从不同方向到达终点的消耗不同,终点的前一个状态不一定比这一状态更优……一开始并没有意识到这一点……wa了一篇……后来加了dp维护……但其实在将点弹出的之后再更新vis也可以……以前因为更新vis的问题T过……留下了阴影…… 代…