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 11300528 at 2005-11-17 20:34:17 on Problem 1067
In Reply To:请大家看看我的程序! Posted by:11300528 at 2005-11-17 20:12:31
> #include <stdio.h>
> long equ(long j,long a)
> {return(j==a?1:0);
> }
> main()
> {long i=1,j=1,k=0,l,t,a,b;
>  scanf("%d %d",&a,&b);
>  k=a<b?a:b; t=k;
>  for(;k>0;k--)
>     {i=i+1,j=j+2;
>      l=equ(j,t);
>      if(l) break;
>      i=i+1,j=j+1;
>      l=equ(j,t);
>      if(l) break;
>      i=i+1,j=j+2;
>      l=equ(j,t);
>      if(l) break;
>     }
>  i=i+j;
>  t=a>b?a:b;
>  if(i==t)
>     printf("%ld\n",l-1);
>  else
>     printf("%ld\n",l);
> 
> }
> 为什么总是"Wrong answer"呀?我感觉对呀.我是根据上边的讨论写的.

不好意思哦,scanf("%d %d",&a,&b);应该是scanf("%ld %ld",&a,&b);
可是我改了后,和是不正确.到底是怎么回事啊?


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