上一页 1 2 3 4 5 6 7 8 9 10 ··· 16 下一页
摘要: View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 4 int main() 5 { 6 int i,n,a,b,sum,ncases,m; 7 8 scanf("%d",&ncases); 9 while( ncases-- ) 10 {11 scanf("%d",&n);12 sum = 0; 13 for(i=0; i<n; i++)14 {15 scanf("%d",&m); 16 ... 阅读全文
posted @ 2012-05-31 19:22 zhongya 阅读(98) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 int main() 4 { 5 int a,b; 6 7 scanf("%d%d",&a,&b); 8 printf("%d\n",a+b); 9 return 0; 10 } 阅读全文
posted @ 2012-05-31 19:21 zhongya 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 一开始做图形遍历的题都是用链表做的,这次用数组体会到了方便但就是有点浪费。不过题目给的内存限制已经足够了。View Code 1 #include<cstdio> 2 #include<cstdlib> 3 #include<cstring> 4 #include<queue> 5 #include<iostream> 6 7 using namespace std; 8 9 typedef struct10 {11 int v;12 int step; 13 }Point;14 Point P[21];15 int visit[21 阅读全文
posted @ 2012-05-24 22:32 zhongya 阅读(154) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 5 int main() 6 { 7 int i, j, ncases,n,m,k, T; 8 int a[200], b[350], c; 9 10 scanf("%d",&ncases);11 while( ncases-- )12 {13 scanf("%d",&T);14 memset(a,0,sizeof(a));15 for(i=0; i< 阅读全文
posted @ 2012-05-24 15:34 zhongya 阅读(116) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 int main() 5 { 6 int i, j, ncases, n, k; 7 int a[31][31],flag[4],ok; 8 9 scanf("%d",&ncases);10 while( ncases-- )11 {12 scanf("%d",&n); 13 memset(flag,0,sizeof(flag));14 for(i=0; i 阅读全文
posted @ 2012-05-24 15:34 zhongya 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 一开始拿到这道题时,有点纠结排序后的字符串不知道怎么转回来,最后经别人提醒我把字符和数绑定成一个数组就可以了View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #include<math.h> 5 6 int i; 7 typedef struct 8 { 9 char s[10];10 int n;11 }numble;12 numble num[51];13 14 char word[51][10], sort[51];15 void revers 阅读全文
posted @ 2012-05-24 15:32 zhongya 阅读(124) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 4 int main() 5 { 6 int i,last=0,num[14],n; 7 int a,b,c,d,e,f; 8 9 while(scanf("%d",&n)&&n)10 {11 if(last) printf("\n"); 12 for(i=0; i<n; i++)13 scanf("%d",&num[i]); 1... 阅读全文
posted @ 2012-05-24 15:03 zhongya 阅读(150) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<cstdio> 2 #include<cstdlib> 3 #include<iostream> 4 #include<queue> 5 #include<malloc.h> 6 #include<cstring> 7 #define N 100001 8 9 using namespace std;10 11 typedef struct city12 {13 int v;14 struct city *next;15 }City;16 17 City c[N];18 int n 阅读全文
posted @ 2012-05-15 22:21 zhongya 阅读(159) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h>//注意细节 2 #include<string.h> 3 #include<stdlib.h> 4 5 int cmp(const void *a,const void *b) 6 { 7 return *(int *)a - *(int *)b; 8 } 9 10 int main()11 {12 int i,j,ncases,N;13 int a[55],b[55],k,c;14 15 scanf("%d",&ncases);16 17 memset(a,0,size 阅读全文
posted @ 2012-05-07 22:44 zhongya 阅读(119) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h>//求出最小生成树之后,再求出第n-m大的值就行了 2 #include<stdlib.h> 3 #include<math.h> 4 #include<string.h> 5 #define N 501 6 #define Maxint 9999999 7 8 double c[N][N],x[N],y[N],dist[N]; 9 int s[N], closest[N],n;10 11 int cmp(const void *a,const void *b) 12 { 13 retur 阅读全文
posted @ 2012-04-29 16:15 zhongya 阅读(196) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 16 下一页