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

高手帮忙看下程序有何问题:(本地通过simpleinput,但过不了online judge!

Posted by smartzhx at 2004-04-10 22:59:17 on Problem 1617
#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:
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