Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
请问一下为什么这样都WA?#include<stdio.h> #include<string.h> #include<stdlib.h> #include<memory.h> char s[200][200]; int Comp(const void *p1,const void *p2) { return strcmp((char *)p1,(char *)p2); } void main() { int i,j,n,p,sum; scanf("%d %d",&n,&p); memset(s,'0',sizeof(s)); for(i=1;i<=n;i++) s[i][p+1]='\0'; while(scanf("%d %d",&i,&j)!=EOF) { /* if(i==0&&j==0) break;*/ s[i][j]='1'; } qsort(s,n,sizeof(s[0]),Comp); /* for(i=1;i<=n;i++) printf("%s\n",s[i]);*/ i=1;sum=1; while(i<n) { if(strcmp(s[i],s[i+1])!=0) sum++; i++; } printf("%d\n",sum); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator