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 |
在我机子上试验了好多次都行,为什么不能被AC呢?请高手指点。#include<iostream.h> #include<string.h> #include<stdio.h> void main() {int m,n,t; int a[100]={0}; cin>>m>>n; int i; char s[100][51]={0}; char s0[100]; for(i=0;i<m;i++) { //scanf("%s\n",s[i]); cin>>s[i]; for(int j=0;j<n;j++) { for(int b=j+1;b<n;b++) {if(s[i][j]<s[i][b]) a[i]++; } } } for(i=0;i<m-1;i++) for(int j=0;j<m-i-1;j++) if(a[j]<a[j+1]) {t=a[j]; a[j]=a[j+1]; a[j+1]=t; strcpy(s0,s[j]); strcpy(s[j],s[j+1]); strcpy(s[j+1],s0); } for(i=0;i<=m-1;i++) cout<<s[i]<<endl; //for(i=0;i<m;i++) //cout<<a[i]<<endl;} } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator