上一页 1 ··· 3 4 5 6 7 8 下一页
摘要: #include"stdio.h"int a[1005][1005];bool used[1005];int dis[1005];int main(){ int t,n,i,j,k,x,y,s,tmin; for(i=0;i<1005;i++) for(j=0;j<1005;j++) a[i][j]=99999999; for(i=0;i<1005;i++) { used[i]=0; a[i][i]=0; dis[i]=99999999; } scanf("%d %d",&t,&n); for(i=0;i<t;i+ 阅读全文
posted @ 2011-08-01 15:53 bcy 阅读(143) 评论(0) 推荐(0) 编辑
摘要: #include"stdio.h"#include"stdlib.h"#include"string.h" int M,N,set[1010];int find(int x){ return x==set[x]? x:set[x]=find(set[x]);}int Union(int x,int y){ int a=find(x),b=find(y); if(a!=b) set[a]=b;}int main(){ int a,b,x,y,sum; while(scanf("%d%d",&N,&M) 阅读全文
posted @ 2011-07-31 22:10 bcy 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Problem B: BTime Limit: 1 SecMemory Limit: 128 MBSubmit: 96Solved: 43[Submit][Status][Web Board]DescriptionNow that you're back to school for another term, you need to remember how to work the combination lock on your locker. A common design is that of the Master Brand, shown at right. The lock 阅读全文
posted @ 2011-07-30 22:10 bcy 阅读(254) 评论(0) 推荐(0) 编辑
摘要: Problem F: FTime Limit: 1 SecMemory Limit: 128 MBSubmit: 221Solved: 56[Submit][Status][Web Board]DescriptionSuperbowl Sunday is nearly here. In order to pass the time waiting for the half-time commercials and wardrobe malfunctions, the local hackers have organized a betting pool on the game. Members 阅读全文
posted @ 2011-07-30 21:47 bcy 阅读(218) 评论(0) 推荐(0) 编辑
摘要: #include"stdio.h"#include"string.h"int k,num[10024],add[10024],pri[10024],pos;void cal(){ int m=0; for(int i=1;i<=k;++i) { if((add[i-1]+num[i])>0&&add[i-1]>0) { add[i]=add[i-1]+num[i]; pri[i]=pri[i-1]; } else { if(num[i]>0) add[i]=num[i]; else add[i]=0; } if(a 阅读全文
posted @ 2011-07-27 16:10 bcy 阅读(185) 评论(0) 推荐(0) 编辑
摘要: #include"stdio.h"#include"string.h"#include"stdlib.h"int main(){ int n,v[60],m[110]; int c1[250010],c2[250010]; while(scanf("%d",&n),n>0) { memset(v,0,sizeof(v)); memset(m,0,sizeof(m)); int sum=0; for(int i=1;i<=n;i++) { scanf("%d%d",&v 阅读全文
posted @ 2011-07-26 21:50 bcy 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 问题 B: 素MM时间限制: 1 Sec内存限制: 128 MB提交: 30解决: 17[提交][状态][讨论版]题目描述素数有很多神奇的性质,所以很美。我们知道一个日期将年、月、日按顺序连接在一起可以组成一个八位数,例如2011年3月6日可以写成20110306。我的某个MM的生日组成的数是一个素数。偶尔我叫她素MM,没人知道是啥意思,她自己也不知道。O(∩_∩)O哈哈~我心里可是真的美美的(⊙o⊙)哦!嗯,什么?你的生日也是素数?你也想做“素MM”或者“素GG”?那好吧,不过我可是很小气的哦!只有你出生在1988年或者1989年我才让你做“素MM”或“素GG”。要不然,你把这两年里日期组成 阅读全文
posted @ 2011-07-26 15:05 bcy 阅读(529) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> #include<stdlib.h> int cmp(const void *a, const void *b) { return *(int *)a-*(int *)b; } int main() { int a[101]; int b[101]={0}; int m; int k=0; while(scanf("%d",&m)!=EOF) { int i,j; for(i=0;i<m;i++) scanf("%d",&a[i]); for(i=0;i<m;i++) 阅读全文
posted @ 2011-07-25 15:23 bcy 阅读(468) 评论(0) 推荐(0) 编辑
摘要: unique()函数是一个去重函数,STL中unique的函数 unique的功能是去除相邻的重复元素(只保留一个),还有一个容易忽视的特性是它并不真正把重复的元素删除。他是c++中的函数,所以头文件要加#include<iostream.h>,具体用法如下: int num[100]; unique(num,mun+n)返回的是num去重后的尾地址,之所以说比不真正把重复的元素删除,其实是,该函数把重复的元素一到后面去了,然后依然保存到了原数组中,然后返回去重后最后一个元素的地址,因为unique去除的是相邻的重复元素,所以一般用之前都会要排一下序。 阅读全文
posted @ 2011-07-25 11:40 bcy 阅读(1195) 评论(0) 推荐(0) 编辑
摘要: #include"stdio.h"#include"stdlib.h"#include"iostream.h"using namespace std;int cmp(const void *num,const void *num1){ return *(int *)num-*(int *)num1;}int main(){ int num[101],num1[101]={0}; int N,k=0,M; while(scanf("%d",&N)!=EOF) { M=N; for(int i=0;i<N 阅读全文
posted @ 2011-07-25 11:38 bcy 阅读(192) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 下一页