Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

自己编的貌似很乱,但为什么输入N个字母后不直接换行,不晓得为什么,求助高人

Posted by anle at 2009-04-06 10:04:58 on Problem 1007
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator