| ||||||||||
| 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 | |||||||||
快崩溃了,找不出问题,求哪位大神帮一下忙,感激!!#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int n,m,i,j,k,key;
int count[110],c[110];
char a[5010],poj;
scanf("%d %d\n",&n,&m);
for(i=1;i<=(n+1)*m;i++)
{
scanf("%c",&a[i]);
}
for(i=1;i<=m;i++)
{count[i]=0;
for(j=(i-1)*(n+1)+1;j<=i*(n+1)-1;j++)
for(k=j+1;k<=i*(n+1)-1;k++)
{if(a[j]>a[k]) count[i]++;}
}
for(i=1;i<=m;i++)c[i]=i;
for(i=1;i<=m;i++)
{
for(j=i+1;j<=m;j++)
{
if(count[i]>count[j])
{ poj=count[i];count[i]=count[j];count[j]=poj;
poj=c[i];c[i]=c[j];c[j]=poj;
}
}
}
for(i=1;i<=m;i++)
for(j=(c[i]-1)*(n+1)+1;j<=c[i]*(n+1);j++)
printf("%c",a[j]);
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator