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

哪位英雄给我这题的一点特殊的测试数据,或者帮我测试下程序.....

Posted by qpwoei at 2007-04-28 22:01:29 on Problem 3218
#include<iostream>
#include<string>arcsin
#include<iomanip>
using namespace std;

const int MAX=75;

void L(string s)
{
int k,len,m;
 string Temp;
  cout.unsetf(ios::left);
 cout.unsetf(ios::right);

 len=s.length();

 k=MAX;
 m=-1;
 while(len-k>0)
 {
  if(s[k]>=33&&s[k]<=126&&s[k+1]==' ')
  {
   Temp="";
   for(m++;m<=k;m++)
     Temp+=s[m];
  
   cout<<setiosflags(ios::left)<<setw(75)<<Temp;
   cout<<endl; 
   k=k+MAX+1;
  }
  else k--;
 }
 Temp="";
 for(m++;m<len;m++)
 Temp+=s[m];


 cout<<setiosflags(ios::left)<<setw(75)<<Temp<<endl;




}







void R(string s)
{
int k,len,m;
 string Temp;
 cout.unsetf(ios::left);
 cout.unsetf(ios::right);

 len=s.length();

 k=MAX;
 m=-1;
 while(len-k>0)
 {
  if(s[k]>=33&&s[k]<=126&&s[k+1]==' ')
  {
   Temp="";
   for(m++;m<=k;m++)
     Temp+=s[m];
   cout<<setiosflags(ios::right)<<setw(75)<<Temp;
   cout<<endl; 
   k=k+MAX+1;
  }
  else k--;
 }
 Temp="";
 for(m++;m<len;m++)
 Temp+=s[m];

 cout<<setiosflags(ios::right)<<setw(75)<<Temp<<endl;



}
void C(string s)
{
 int i,j,k,len,m;
 string Temp;
  cout.unsetf(ios::left);
 cout.unsetf(ios::right);

 len=s.length();

 k=MAX;
 m=-1;
 while(len-k>0)
 {
  if(s[k]>=33&&s[k]<=126&&s[k+1]==' ')
  {
   Temp="";
   for(m++;m<=k;m++)
     Temp+=s[m];
   j=Temp.length();
   j=MAX-j;
   j/=2;
   for(i=0;i<j;i++)
	   cout<<' ';
   cout<<Temp;
   cout<<endl; 
   k=k+MAX+1;
  }
  else k--;
 }
 Temp="";
 for(m++;m<len;m++)
 Temp+=s[m];
 
 for(i=0;i<(75-Temp.length())/2;i++)
	 cout<<' ';
 cout<<Temp;
 cout<<endl;


}
void J(string s)
{
 int k,i,len,j,m,c,n; 
 string Temp,Temp2;
 len=s.length();
 k=MAX;
 m=-1;
  cout.unsetf(ios::left);
 cout.unsetf(ios::right);

 while(len-k>0)
 {
  if(s[k]>=33&&s[k]<=126&&s[k+1]==' ')
  {
   Temp="",Temp2="";
   for(m++;m<=k;m++)
     Temp+=s[m];
   j=Temp.length();
   j=MAX-j;
 
   c=0;
   while(Temp.length()<75)
   {
    for(i=0;i<Temp.length();i++)
	{

	 if(Temp[i]==' ')
	   {
		   if(j>0){
			   Temp2+=Temp[i];Temp2+=' ';
			   for(n=0;n<c;n++)
			    Temp2+=' ';
			   
			   j--;i+=c;
		   
		   }
            else  Temp2+=Temp[i];
	   }
			else Temp2+=Temp[i];
	
	
	}
    c++;
    Temp=Temp2;
    Temp2="";
   
   }
   cout<<Temp<<endl;
 
   k=k+MAX+1;
  }
  else k--;
 }
 for(m++;m<len;m++)
 cout<<s[m];
 cout<<endl;
}





int main()
{
 char sign,Temp,Flag=1,i;
 char s[100000];

 cin>>sign;
 i=0;
 Temp=getchar();
 while(Temp=getchar(),Temp!='\n')
 {
  if(Temp==' ')
  {if(Flag==0)
  {s[i]=Temp;Flag=1;i++;}}
  else
	  if(Temp>=33&&Temp<=126)
	  {
	      Flag=0;
		  s[i]=Temp;
		  i++;
	  }

 
 }
  s[i]=0;
 
 switch(sign)
 {
   case 'L':{L(s);break;}
   case 'R':{R(s);break;}
   case 'C':{C(s);break;}
   case 'J': {J(s);break;}
 
 
 }
 
 return 0;
}

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