3893: [Usaco2014 Dec]Cow JogTime Limit:10 SecMemory Limit:128 MBSubmit:174Solved:87[Submit][Status][Discuss]DescriptionThe cows are out exercising the...
分类:
其他好文 时间:
2015-04-05 23:11:12
阅读次数:
247
3016: [Usaco2012 Nov]Clumsy CowsTime Limit:1 SecMemory Limit:128 MBSubmit:91Solved:69[Submit][Status][Discuss]DescriptionBessie the cow is trying to t...
分类:
其他好文 时间:
2015-04-05 20:12:05
阅读次数:
129
题目大意: 给你两个数字,n和k,对于n有三种变化规则。 1.n->n-1; 2.n->n+1; 3.n->2*n; 使得n==k,问如何需要最少的操作次数。解题思路: 凡是有关最少操作次数的问题,就归结为bfs来求解,这道题是一个三入口式的bfs。。。在搜索的过程中,一定要注意是否有需...
分类:
其他好文 时间:
2015-04-04 19:40:32
阅读次数:
151
/* poj 3617 best cow line
题意为给定长度为N的字符串S,需要构造出长度为N的字符串T,开始的时候T是一个空串
随后只能反复从S的开始或者结尾的地方取一个字符接到T的末尾,要求是根据这个规则
构造出字典序尽可能小的字符串T
算法设计:每次都比较末尾和开头的字符,如果不想等,则选择字典序较小的那个字符
接到T的末尾,这样构造出来的...
分类:
其他好文 时间:
2015-04-02 22:37:59
阅读次数:
181
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