Gym 100090M Jumping along the Hummocks】的更多相关文章

题意: 从 前往后跳,要么跳一步,跳到相邻的位置,要么跳到下一个数字相同的位置,求跳到最后的最少步数. dp,但是会tle,我用map优化了一下. #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; ]; ]; int main() { int n; while(~scanf("%d",&n)) { ;i<n;i++) { scanf("%d",…
题目链接:http://codeforces.com/gym/101147/problem/E 题意:当人在第i个商店时,他可以向左或向右跳di段距离到达另一个商店(在范围之内),一个商店为一段距离.问:对于每一个商店,跳到最后一个商店最少需要跳几次? 题解:题目实际上是求最短距离,而且边权为1,所以可以直接用bfs.由于是求每个点到最后一个点的最短距离,那么可以反向建图,将最后一个点设为起始点,然后向前跑.对于跑不到的点,回到题目上说,实际就是这个商店不能到达最后一个商店. 代码如下: #in…
B. Lunch Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100637/problem/B Description The swamp looks like a narrow lane with length n covered by floating leaves sized 1, numbered from 1 to n with a fly sitting on the top of ea…
 Gym 101047M Removing coins in Kem Kadrãn Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output Andréh and his friend Andréas are board-game aficionados. They know many of their friend…
 Gym 101047K Training with Phuket's larvae Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output Thai cuisine is known for combining seasonings so that every dish has flavors that are…
Gym 101047E Escape from Ayutthaya Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u  Practice  Description standard input/output Ayutthaya was one of the first kingdoms in Thailand, spanning since its foundation in 1350 to…
 Gym 101047B  Renzo and the palindromic decoration Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output At the ruins of Wat Phra Si Sanphet (วดพระศรสรรเพชญ), one can find famous inscr…
/* Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now. The game can be played by two or more than two players.…
Bungee JumpingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1205 Accepted Submission(s): 528 Problem DescriptionOnce again, James Bond is fleeing from some evil people who want to see him dead. F…
Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now. The game can be played by two or more than two players. It consi…