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 <iostream> #include<stdio.h> using namespace std; int cmp(const void* a,const void* b) { return (*(int*)a-*(int*)b); } int main() { int n[55]; char s[55][105]; int m,len; cin>>len>>m; for(int i=0;i<m;i++) { scanf("%s",s[i]); n[i]=0; for(int j=0;j<len-1;j++) { for(int k=j+1;k<len;k++) if(s[i][j]>s[i][k])n[i]++; } n[i]=n[i]*10000+i; } qsort(n,m,sizeof(n[0]),cmp); for(int i=0;i<m;i++) printf("%s\n",s[n[i]%10000]); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator