| ||||||||||
| 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 | |||||||||
我的程序在自己电脑上过了,为什么会Wrong Answer.#include<iostream.h>
void main()
{
char a[100][51];
int s[100]={0};
char b[51];
int n,m;
cin>>n>>m;
for(int i=0;i<m;i++)
{
cin>>a[i];
}
for(int j=0;j<m;j++)
{
for(int k=0;k<n;k++)
{
for(int l=k+1;l<n;l++)
{
if(a[j][k]>a[j][l])
s[j]++;
}
}
}
int x=0;
for(int d=1;d<m;d++)
{
x=s[d];
for(int v=0;v<n;v++)
{
b[v]=a[d][v];
}
for(int f=d-1;f>=0;f--)
{
if(x<s[f])
{
s[f+1]=s[f];
for(int r=0;r<n;r++)
a[f+1][r]=a[f][r];
}
else break;
}
s[f+1]=x;
for(int w=0;w<n;w++)
a[f+1][w]=b[w];
}
for(int y=0;y<m;y++)
cout<<a[y]<<endl;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator