
usaco
zyq_20030305
der
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
USACO 2015 Dec Platinum 1.Max Flow题解,
#include<stdio.h> int f[500001][21]; int level[500001]; int to[1000001];//边开2倍 int next[1000001]; int head[500001]; int fa[500001]; int sum,tmp; void addedge(int a,int b)//链表存边 { next[++sum]=head[a]; head[a]=sum; to[sum]=b; } void dfs(int x) { for(int原创 2017-08-15 09:37:28 · 347 阅读 · 0 评论 -
usaco training Ordered Fractions
#include<stdio.h> int x[15001],y[15001],z=1e9,idx; int gcd(int x,int y) { while(y) { z=x%y; x=y; y=z; } return x; } int main() { int n,i,j,v; scanf("%d",&n); printf("0/1\n"); for(i=1;i<=n;i++) for(j=1;j<i;j++) { if(gcd(i,j)==1) x原创 2017-09-10 20:30:32 · 253 阅读 · 0 评论 -
dp 最大全1子正方形
例题1:usaco Big Barn 巨大的牛棚 Big Barn 巨大的牛棚 Description 农夫约翰想要在他的正方形农场上建造一座正方形大牛棚。他讨厌在他的农场中砍树,想找一个能够让他在空旷无树的地方修建牛棚的地方。我们假定,他的农场划分成 N x N 的方格。输入数据中包括有树的方格的列表。你的任务是计算并输出,在他的农场中,不需要砍树却能够修建的最大正方形牛棚原创 2017-09-26 22:15:51 · 395 阅读 · 0 评论 -
usaco training Barn Repair题解
#include<stdio.h> #include<algorithm> using namespace std; int d[201],f[201]; int main() { int a,b,c,i; scanf("%d%d%d",&a,&b,&c); for(i=1;i<=c;i++) scanf("%d",&d[i]); sort(d+1,d+c+1); for(i=1;i<=c;i++) f[i]=d[i]-d[i-1]; int ans=b; ans-=d[1]原创 2017-09-11 22:18:26 · 253 阅读 · 0 评论 -
usaco Training Cow Tours
#include<stdio.h> #include<string.h> #include<math.h> int a[151][151]; double f[151][151]; double x[151],y[151]; double mia[151]; double distance(int i,int j) { return sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])); } double max(double x,double原创 2017-09-04 23:09:53 · 255 阅读 · 0 评论 -
bzoj1774 USACO 2009 Dec Gold 2.Cow Toll Paths 过路费 翻译+题解
Description Like everyone else, FJ is always thinking up ways to increase his revenue. To this end, he has set up a series of tolls that the cows will pay when they traverse the cowpaths throughout t...原创 2017-10-06 11:01:51 · 853 阅读 · 0 评论 -
USACO 2014 Dec Silver 1.Piggyback 题解
Description Bessie and her sister Elsie graze in different fields during the day, and in the evening they both want to walk back to the barn to rest. Being clever bovines, they come up with a pla原创 2018-01-03 19:57:19 · 459 阅读 · 0 评论 -
USACO 2008 Nov Gold 2.Cheering up the Cows最小生成树 题解
Description Farmer John has grown so lazy that he no longer wants to continue maintaining the cow paths that currently provide a way to visit each of his N (5 1..N). Each and every pasture is h原创 2018-01-03 19:53:23 · 288 阅读 · 0 评论