| ||||||||||
| 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 | |||||||||
高手帮忙看下程序有何问题:(本地通过simpleinput,但过不了online judge!#include<iostream.h>
#include<string.h>
void main()
{ char text[100][10];
char pt[100][10];
char tex[101];
char key[11];
int xu[10];
int len,lenw,i,j,lent,k,temp,ch;
cin>>key;
while(strcmp(key,"THEEND"))
{ cin>>tex;
lent=strlen(tex);
len=strlen(key);
lenw=lent/len;
k=0;
for(i=0;i<len;i++)
for(j=0;j<lenw;j++)
{ text[j][i]=tex[k];k++;
}
for(i=0;i<len;i++)
xu[i]=i;
for(i=0;i<len-1;i++)
for(j=i+1;j<len;j++)
if(key[j]<key[i]) {ch=key[j];key[j]=key[i];key[i]=ch;
temp=xu[j];xu[j]=xu[i];xu[i]=temp;
}
for(i=0;i<len;i++)
for(j=0;j<lenw;j++)
pt[j][xu[i]]=text[j][i];
for(i=0;i<lenw;i++)
for(j=0;j<len;j++)
cout<<pt[i][j];
cout<<endl;
cin>>key;
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator