| ||||||||||
| 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 | |||||||||
为什么一直OLE啊?#include<iostream>
#include<string>
using namespace std;
const int M = 100;
const int N = 50;
char s[M][N];
int a[M];
bool b[M];
int main()
{
int i,j,k,n,m,temp=0;
memset(a,0,sizeof(a));
cin>>n>>m;
for(i=0;i<m;i++)
cin>>s[i];
for(i=0;i<m;i++)
{
temp=0;
for(j=0;j<n-1;j++)
{
for(k=j+1;k<n;k++)
{
if(s[i][j]>s[i][k])
{
temp++;
}
}
}
a[i]+=temp;
}
for(i=0;i<m;i++)
{
temp=0;
int min=999999999;
for(j=0;j<m;j++)
{
if(a[j]<min&&b[j]==0)
{
min=a[j];
temp=j;
}
}
if(i!=m-1)
cout<<s[temp]<<endl;
else
{
cout<<s[temp]<<endl;
//system("pause");
return 0;
}
b[temp]=1;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator