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 |
各位大侠,帮我看看有什么错误,万分谢谢!#include<stdio.h> #include<stdlib.h> #include<malloc.h> #include<string.h> #define r 100 #define l 51 void main() { int a,b,i,j,k,h[r]={0},g[r]={0},m[r]={0},t; char d[r][l]; scanf("%d %d",&a,&b); for(i=0;i<b;i++) { for(j=0;j<a+1;j++) { d[i][j]=getchar(); //scanf("%c",&d[i][j]); } for(j=1;j<a+1;j++) { for(k=0;k<j;k++) { if(d[i][j]<d[i][k]) { h[i]++; g[i]++; } } } } for(i=0;i<b-1;i++) { for(j=i+1;j<b;j++) { if(g[j]<g[i]) { t=g[j]; g[j]=g[i]; g[i]=t; } } //printf(" %d ",g[i]); } for(i=0;i<b;i++) { for(j=0;j<b;j++) { if(h[j]==g[i]&&m[j]==0) { m[j]=1; for(k=0;k<a+1;k++) putchar(d[j][k]); } } } printf("\n"); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator