摘要: 一开始做图形遍历的题都是用链表做的,这次用数组体会到了方便但就是有点浪费。不过题目给的内存限制已经足够了。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 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 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 #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) 编辑