题意: 有一座电梯,其中楼层从1-n,每层都有一个数字k,当处于某一层时,只能往上走k层,或者下走k层.楼主在a层,问是否能到达第b层? 思路: 在起点时只能往上走和往下走两个选择,之后的每层都是这样,那么就类似于二叉树.每个节点就是对应的层,因为有可能碰到循环的层,比如1跳到3,3跳回1,这样使得无限循环,所以加个vis数组标记是否遍历过即可. #include <iostream> #include <cmath> #include <cstring> #inclu…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1548 A strange lift Description There is a strange lift.The lift can stop can at every floor as you want, and there is a number $K_i(0 \leq K_i \leq N)$ on every floor.The lift have just two buttons: up…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1548 There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and down.When you at floor i,if yo…
A strange lift http://acm.hdu.edu.cn/showproblem.php?pid=1548 Problem Description There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and…
题目链接 Problem Description There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and down.When you at floor i,if you press the button "UP…
A strange lift Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18723    Accepted Submission(s): 6926 Problem Description There is a strange lift.The lift can stop can at every floor as you want,…
题目链接: 传送门 A strange lift Time Limit: 1000MS     Memory Limit: 32768 K Description There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1548 A strange lift Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 21754    Accepted Submission(s): 7969 Problem Description There is a strange li…
A strange lift Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8550    Accepted Submission(s): 3241 Problem Description There is a strange lift.The lift can stop can at every floor as you want,…
A strange lift Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 26943    Accepted Submission(s): 9699 Problem Description There is a strange lift.The lift can stop can at every floor as you want,…