
USACO
sumi
无冥冥之志者无昭昭之明 无惛惛之事者无赫赫之功!
有问题欢迎大家联系我,扣扣2513822561
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
USACO 1.1.2 Greedy Gift Givers
/* ID:wconvey1 TASK:gift1 LANG:C++ */ #include #include #include using namespace std; struct node{ char s[16]; int m; }q[15]; int main() { freopen("gift1.in","r",stdin); freopen("gift1.out","w",st原创 2012-04-25 20:45:55 · 475 阅读 · 0 评论 -
USACO 1.3.5 Prime Cryptarithm
题目分析:暴力 /* ID:wconvey PROG:crypt1 LANG:C++ */ #include #include #include #include using namespace std; int cmp(int x,int y) { return x<y; } int main() { freopen("crypt1.in","r",stdin); freopen("cr原创 2012-06-08 22:37:26 · 621 阅读 · 0 评论 -
USACO 1.4.2 The Clocks(DFS)
题目分析: 注意 1.一个变换 用4次 ,相当于没有变换,用一个number[i]数组记录每个变换次数 2.确定的变换 序列,与其变换顺序,没有关系(没注意这所以一直写不对) /* ID:wconvey PROG:clocks LANG:C++ */ #include #include #include #include using name原创 2012-06-09 22:11:32 · 744 阅读 · 0 评论 -
USACO 1.3.4 Calf Flac(最大回文子串)
题目分析: 1.直接枚举回文串的起始位置和重点位置会超时,O(n^3),会超时,最长的回文串为2000; 2. 直接枚举中间位置,O(n^2), 3.先对字符文本进行预处理,对非字母符号全部去掉,s1[20100],开一个p[20100]记录s1[i]在原字符串中的位置, 方便输出原字符串. 4.注意它的输入,是以文本的形式输入,可能有好几行,原创 2012-05-29 09:32:48 · 811 阅读 · 0 评论 -
USACO 1.2.2 Transformations
/* ID:wconvey PROG:transform LANG:C++ */ #include #include using namespace std; int n; char maze[12][12],m[12][12],maze1[12][12]; int match() { int i,j; for(i=0;i<n;i++) for(j=0;j<n;j++) if(m[原创 2012-04-25 20:51:05 · 468 阅读 · 0 评论 -
USACO 1.1.3 Friday the Thirteenth
/* ID: wconvey PROG: friday LANG: C++ */ #include #include #include using namespace std; int is_leap_year(int x) { if(x%400==0||(x%4==0&&x%100!=0)) return 1; else return 0; } int main() { in原创 2012-04-25 20:46:55 · 368 阅读 · 0 评论 -
USACO 1.3.1 Mixing Milk
/* ID:wconvey PROG:milk LANG:C++ */ #include #include using namespace std; struct node{ int p,a; }array[5100]; int cmp(const void *x,const void *y) { if(((struct node *)x)->p!=((struct node原创 2012-04-25 20:54:33 · 448 阅读 · 0 评论 -
USACO 1.2.5 Dual Palindromes
/* ID:wconvey PROG:dualpal LANG:C++ */ #include #include using namespace std; int main() { int n,s,i,j,k,flag,temp,c,b,cnt; int a[1000]; freopen("dualpal.in","r",stdin); freopen("dualpal.out",原创 2012-04-25 20:53:59 · 469 阅读 · 0 评论 -
USACO 1.2.4 Palindromic Squares
/* ID:wconvey1 PROG:palsquare LANG:C++ */ #include #include using namespace std; int main() { int b,i,j,len,len1,n,temp; char s[20],s1[20]; freopen("palsquare.in","r",stdin); freopen("palsquare.o原创 2012-04-25 20:52:50 · 444 阅读 · 0 评论 -
USACO 1.2.3 Name That Number
/* ID:wconvey PROG:namenum LANG:C++ */ #include #include using namespace std; int num[26]={2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,0,7,7,8,8,8,9,9,9,0}; int name[13]; char les[13]; int main() { freopen("na原创 2012-04-25 20:52:01 · 609 阅读 · 0 评论 -
USACO 1.2.1 Milking Cows
/* ID:wconvey1 PROG:milk2 LANG:C++ */ #include #include #include struct node{ int s,e; }; node a[5010]; int cmp(const void *x,const void *y) { if(((struct node *)x)->s!=((struct node *)y)->s)原创 2012-04-25 20:50:05 · 438 阅读 · 0 评论 -
UASCO 1.1.4 Broken Necklace
/* ID:wconvey PROG: beads LANG: C++ */ #include #include using namespace std; int main() { char s[1200],lchar,rchar; int l,r,i,j,k,n,temp1=0,temp2=0,max=0; freopen("beads.in","r",stdin); freopen(原创 2012-04-25 20:48:37 · 428 阅读 · 0 评论 -
USACO 1.4.1
题目分析: #include #include #include #include using namespace std; struct node { int l,w; }arr[5]; struct mode { int ans; int p,q; }res[100]; int cmp(node x,node y) { if(x.l==y.l) return x.w<y.w;原创 2012-06-09 14:54:11 · 534 阅读 · 0 评论