题意:给定农夫和奶牛的初始位置,农夫可以当前位置+1.-1.*2三种移动方式,问最少需要多少分钟抓住奶牛 AC代码: #include<cstdio> #include<cstring> #include<queue> using namespace std; const int maxn=100000+5; const int dx[]={-1,1,2}; int d[maxn]; int n,k; int bfs(){ queue<int>q; mems…
题目链接:http://i.cnblogs.com/EditPosts.aspx?opt=1 Catch That Cow Time Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7909 Accepted Submission(s): 2498 Problem Description Farmer John has been inform…
1646: [Usaco2007 Open]Catch That Cow 抓住那只牛 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 634 Solved: 310[Submit][Status] Description Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a p…
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,000) on a number line and the cow is at a point K (0 <= K <= 100,000) on the same number line…
BFS... -------------------------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<queue> #define rep( i , n ) for( int i =…
题目DescriptionFarmer 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,000) on a number line and the cow is at a point K (0 <= K <= 100,000) on the same number lin…