P2960 [USACO09OCT]Milkweed的入侵Invasion of the Milkweed 题目描述 Farmer John has always done his best to keep the pastures full of luscious, delicious healthy grass for the cows. He has lost the battle, though, as the evil milkweed has attained a foothold…
题目链接 首先这道题是一道经典的BFS.非常适合刚刚学习深搜的同学. 现在分析一下这个问题.首先,每周是八个方向.就是一圈. 也就是说入侵的范围关于时间是成辐射型扩散.让求最大时间. 也就是完美的BFS.算出来之后,维护一个最大用时就好. 不过说一句.这个数区范围对于一个不会stl的人来说可以直接手写队列. 好了上代码: #include<iostream> #include<stdio.h> #include<algorithm> using namespace st…
P2376 [USACO09OCT]津贴Allowance 题目描述 作为创造产奶纪录的回报,\(Farmer\) \(John\)决定开始每个星期给\(Bessie\)一点零花钱. \(FJ\)有一些硬币,一共有\(N(1<=N<=20)\)种不同的面额.每一个面额都能整除所有比它大的面额. 他想用给定的硬币的集合,每个星期至少给\(Bessie\)某个零花钱的数目\(C(1<=C<=100000000)\).请帮他计算他最多能支付多少个星期的零花钱. 输入输出格式 输入格式:…
P2958 [USACO09OCT]木瓜的丛林Papaya Jungle 题目描述 Bessie has wandered off the farm into the adjoining farmer's land. He raises delicious papaya fruit, which is a delicacy for cows. The papaya jungle is partitioned into a grid of squares with R rows and C col…
P1339 [USACO09OCT]热浪Heat Wave 题目描述 The good folks in Texas are having a heatwave this summer. Their Texas Longhorn cows make for good eating but are not so adept at creating creamy delicious dairy products. Farmer John is leading the charge to delive…
P2959 [USACO09OCT]悠闲漫步The Leisurely Stroll 题目描述 Bessie looks out the barn door at the beautiful spring day and thinks to herself, 'I'd really like to enjoy my walk out to the pastures for the tender spring grass.' She knows that once she leaves the b…
P2958 [USACO09OCT]木瓜的丛林Papaya Jungle 题目描述 Bessie has wandered off the farm into the adjoining farmer's land. He raises delicious papaya fruit, which is a delicacy for cows. The papaya jungle is partitioned into a grid of squares with R rows and C col…
题目传送门 这道题实际非常简单好奇是怎么变黄的... 其实也就是一个SPFA,本人非常懒,不想打邻接表,直接用矩阵就好啦... #include<bits/stdc++.h> using namespace std; ][],m,fr,to; void add(int x,int y,int z){a[x][y]=z;} ]; ]; queue<int> q; void SPFA(int from){ vis[; q.push(; while(!q.empty()){ ; q.po…
题目传送门 这也是个01背包,只是装的很... #include<bits/stdc++.h> #define MAXN 45010 using namespace std; int f[MAXN],w[MAXN],c[MAXN],n,v; int main(){ scanf("%d%d",&v,&n); ;i<=n;i++) scanf("%d",&w[i]); ;i<=n;i++) for(int j=v;j>…
题目描述 The cows enjoy mooing at the barn because their moos echo back, although sometimes not completely. Bessie, ever the excellent secretary, has been recording the exact wording of the moo as it goes out and returns. She is curious as to just how mu…