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

Re:大家的输出要注意了 !!!

Posted by masque at 2009-08-15 21:52:59 on Problem 1604
In Reply To:大家的输出要注意了 !!! Posted by:810974380 at 2009-08-03 10:21:00
> 
> 
> 前1~5列输出N,6~9列输出空格->空格,第十列输出要求的结果.
> 
> 我没看OutPut 直接看的Sample Input 直接数了一下,以为前4列输出N,
> 哪知道9999前面还有一个空格 贡献了n次Presentation Error
> FT!!!
> 
> 
> 
> 
> 附A过的代码(可以参考一下)
> 
> 
> #include<stdio.h>
> int N;
> int Five(int   N)
> {   
>   int   F=0,temp1=5;   
>   while(temp1<=N)   
>   {   
>   F+=N/temp1;   
>   temp1*=5;   
>   }   
>  return   F;   
> }   
> int Two(int   N)
> {   
>   int   T=0,temp2=2;   
>   while(temp2<=N)   
>   {   
>   T+=N/temp2;   
>   temp2*=2;   
>   }   
>  return  T;
> }
> int   Process(int   n)   
> {   
>   while(n%2==0)   n/=2;   
>   while(n%5==0)   n/=5;   
>  return   n;   
> }  
> int   Result(int   N)   
> {   
>   int  i,temp,result=1;   
>  for(i=2;i<=N;i++)   
>  {   
>   result*=(Process(i));   
>   result%=10;   
>  }   
>  temp=Two(N)-Five(N);  
>  if(temp==0)   return   result;   
>  temp%=4;   
>  if(temp==0)   return   (result*6%10);   
>  if(temp==1)   return   (result*2%10);   
>  if(temp==2)   return   (result*4%10);   
>  if(temp==3)   return   (result*8%10);
> }
> int main()
> { while((scanf("%d",&N))!=EOF){
> 	printf("%5d -> %d\n",N,Result(N));
> }
> 	return 0;
> }

有个东西叫setw()...

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