Time Limit: 10 second Memory Limit: 2 MB 问题描述 给出一张地图,这张地图被分为n*m(n,m<=100)个方块,任何一个方块不是平地就是高山.平地可以通过,高山则不能.现在你处在地图的(x1,y1)这块平地,问:你至少需要拐几个弯才能到达目的地(x2,y2)?你只能沿着水平和垂直方向的平地上行进,拐弯次数就等于行进方向的改变(从水平垂直或从垂直到水平)次数 Input 第1行: n m 第1至n+1行:整个地图地形描述(0:空地:1:高山), 第2行地形…
非常可乐 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3688 Accepted Submission(s): 1533 Problem Description 大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为.因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要…
A计划 Time Limit : 3000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 12 Accepted Submission(s) : 9 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description 可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她…
Problem Description The 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 15 sliding tiles, each with a number from 1 to 15 on it, and all packed into a 4 by 4 frame with one…
Sticks Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 128734 Accepted: 30173 Description George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the or…
Prime Ring Problem Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 20105 Accepted Submission(s): 9001 Problem Description A ring is compose of n circles as shown in diagram. Put natural numb…
P1649 [USACO07OCT]障碍路线Obstacle Course 题目描述 Consider an N x N (1 <= N <= 100) square field composed of 1 by 1 tiles. Some of these tiles are impassible by cows and are marked with an 'x' in this 5 by 5 field that is challenging to navigate: . . B x .…
题目Description考虑一个 N x N (1 <= N <= 100)的有1个个方格组成的正方形牧场.有些方格是奶牛们不能踏上的,它们被标记为了’x’.例如下图: . . B x .. x x A .. . . x .. x . . .. . x . . 贝茜发现自己恰好在点A出,她想去B处的盐块添盐.缓慢而且笨拙的动物,比如奶牛,十分讨厌转弯.尽管如此当然在必要的时候她们还是会转弯的.对于一个给定的牧场,请你计算从A到B最少的转弯次数.开始的时候贝茜可以使面对任意一个方向.贝茜知道她…
Description George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had originally and how long they were original…
Sticks Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 110416 Accepted: 25331 Description George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the or…
题目描述 Consider an N x N (1 <= N <= 100) square field composed of 1 by 1 tiles. Some of these tiles are impassible by cows and are marked with an 'x' in this 5 by 5 field that is challenging to navigate: . . B x . . x x A . . . . x . . x . . . . . x .…
题意翻译 题目大意: 给定一个n∗m的矩阵,每次你可以选择前进一格或转弯(90度),求在不出这个矩阵的情况下遍历全部格点所需最少转弯次数.有多组数据 输入格式: 第一行一个整数k,表示数据组数 以下k行,每行两个整数n,m,表示矩阵大小 输出格式: 输出一个整数,即最少转弯次数 感谢@守望 提供翻译 题目描述 Mirko wants to buy land on which he will build a house for his family. So far, he’s seen K pie…
经典搜索水题...... #include<bits/stdc++.h> using namespace std; const int maxn = 20 + 13; const int step[4][2] = {0,1,0,-1,1,0,-1,0}; bool Vis[maxn][maxn]; char Map[maxn][maxn]; int Num, N, M; void BFS(int x, int y) { Vis[x][y] = true; Num = 1; pair<in…