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 |
自己编的貌似很乱,但为什么输入N个字母后不直接换行,不晓得为什么,求助高人#include <iostream> using namespace std; int main() { int n,m,i,j,k,t[100]; char s[50][100]; cin>>n>>m; for(i=0;i<m;i++) t[i]=0; for(i=0;i<m;i++) { for(j=0;j<n;j++) cin>>s[i][j]; cout<<endl; } for(i=0;i<m;i++) for(j=0;j<n;j++) for(k=0;k<n;k++) { if(s[i][j]>s[i][k]) t[i]++; } for(i=0;i<m;i++) for(j=0;j<m;j++) if(t[j]>t[i]) { k=t[i];t[i]=t[j];t[j]=k; } for(i=0;i<m;i++) { for(j=0;j<n;j++) cout<<s[i][j]; cout<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator