Description奶牛们在被划分成N行M列(2 <= N <= 100; 2 <= M <= 100)的草地上游走,试图找到整块草地中最美味的牧草。Farmer John在某个时刻看见贝茜在位置 (R1, C1),恰好T (0 < T <= 15)秒后,FJ又在位置(R2, C2)与贝茜撞了正着。 FJ并不知道在这T秒内贝茜是否曾经到过(R2, C2),他能确定的只是,现在贝茜在那里。 设S为奶...
分类:
其他好文 时间:
2015-04-01 15:22:52
阅读次数:
184
题意:两个整数,N 和 M,N有三种变换:-1 ,+1 , *2 ,求N通过这三种变换变为M的最小的次数
分析:这题用BFS。
这题的问题主要是:
1.难以想到用BFS来做
知道用BFS之后就很快的写出来代码,但是还是出错了:
2.TLE。原因是没有标记出现过的数,广搜一定要记得标记
3.RE。 N的范围在0到1000000,要把N的范围限制在这里面
4.WA。有一种特殊情况 ...
分类:
其他好文 时间:
2015-04-01 09:37:23
阅读次数:
127
暴力搜索(广搜),注意要先判断再加入队列,否则会超内存
#include
#include
#include
#include
#define maxn 100000+5
using namespace std;
int dir[2]={1,-1};
int vis[maxn]={0};
int n,m,re;
int maxx;
struct stu
{
int x,s;
};
voi...
分类:
其他好文 时间:
2015-03-31 09:07:23
阅读次数:
136
13859. Farmer John has no Large Brown Cow
Constraints
Time Limit: 1 secs, Memory Limit: 256 MB
Description
Farmer John likes to collect as many different types of cows as possible. I...
分类:
其他好文 时间:
2015-03-30 09:37:38
阅读次数:
282
13861. Pogo-Cow
Constraints
Time Limit: 1 secs, Memory Limit: 256 MB
Description
In an ill-conceived attempt to enhance the mobility of his prize cow Bessie, Farmer John has attached...
分类:
其他好文 时间:
2015-03-30 09:33:59
阅读次数:
192
9456. Clumsy Cows
Constraints
Time Limit: 1 secs, Memory Limit: 256 MB
Description
Bessie the cow is trying to type a balanced string of parentheses into her new laptop, but she is s...
分类:
其他好文 时间:
2015-03-30 09:22:36
阅读次数:
179
FliptileTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 4031Accepted: 1539DescriptionFarmer John knows that an intellectually satisfied cow i...
分类:
其他好文 时间:
2015-03-29 23:39:51
阅读次数:
150
Cow BowlingTime Limit:1000MSMemory Limit:65536KTotal Submissions:14748Accepted:9804DescriptionThe cows don't use actual bowling balls when they go bow...
分类:
其他好文 时间:
2015-03-29 01:52:05
阅读次数:
163
Catch That Cow
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 52537
Accepted: 16471
Description
Farmer John has been informed of the location of a fugitiv...
分类:
其他好文 时间:
2015-03-22 09:18:40
阅读次数:
165
水题,直接贴代码。
//poj 3180
//sep9
#include
#include
using namespace std;
const int maxN=10024;
const int maxM=50048;
int sum[maxN];
int head[maxN],dfn[maxN],low[maxN],ins[maxN],belong[maxN];
stack s;
st...
分类:
其他好文 时间:
2015-03-22 09:14:36
阅读次数:
102