http://codeforces.com/problemset/problem/540/C You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the…
题意:一个四位数的质数,每次只能变换一个数字,而且变换后的数也要为质数.给出两个四位数的质数,输出第一个数变换为第二个数的最少步骤. 利用广搜就能很快解决问题了.还有一个要注意的地方,千位要大于0.例如0373这个数不符合要求. #include <iostream> #include <cstdio> #include <queue> #include <cmath> #include <map> using namespace std; st…
题意:       给你一个n*m的矩阵,然后给你机器人的起点和终点,还有起点的方向,然后每次机器人有两种操作,左右旋转90度,或者是朝着原来的方向走1,2或者3步,机器人再走的过程中不能碰到格子,也不能碰到边界,输出最少步数. 思路:      比较简单的题目,只是要注意几点. (1)走的过程中边界不可以碰 (2)如果你想一下子走3步的话,记住路程中不能碰墙 (3)mark的时候记得也罢方向mark上. 简单题目,就说这么多吧. #include<queue> #include<std…
Find a way Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 30   Accepted Submission(s) : 14 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description Pass a year learning in Ha…
题目链接:http://poj.org/problem?id=3984 解题报告: 1.设置node结构体,成员pre记录该点的前驱. 2.递归输出: void print(int i) { ) { print(q[i].pre); printf("(%d, %d)\n",q[i].x,q[i].y); } } ][]; ; ; ][]={{,},{-,},{,},{,-}}; struct node{ int x,y; int pre;///从左上角到右下角的每一个元素的,前一个元素…
Catch That Cow Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 45648   Accepted: 14310 Description Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,00…
Find a way Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3226    Accepted Submission(s): 1045 Problem Description Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally.…
http://codeforces.com/problemset/problem/540/C       Ice Cave Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 540C Description You play a computer game. Your character stands on some lev…
题目链接:https://vjudge.net/contest/226823#problem/C You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through t…
ice(USACO) Description Bessie 在一个冰封的湖面上游泳,湖面可以表示为二维的平面,坐标范围是-1,000,000,000..1,000,000,000. 湖面上的N(1 <= N <= 20,000)个位置有石块(编号分别为1到N),其它位置是冰面. 由于Bessie滑冰技术不够好,她通过推动自己旁边的石块,依靠反作用力向某一个方向前进,在碰到一个新的石块之前,Bessie是不会停下来的.(当然,最后会停留在某块石块的前一个格子里)由于Bessie无法计算复杂的角度…