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:各位大虾,为什么我的program出问题了

Posted by ty2004 at 2006-07-21 18:28:49 on Problem 1663
In Reply To:各位大虾,为什么我的program出问题了 Posted by:quanjianan at 2005-07-20 08:05:03
> #include "Stdio.h"
> 
> 
> int main(void)
> {
>  unsigned int i,k,x,y;
>  int a[5001];
>  scanf("%d",&k);
>  for(i=0;i<=k-1;i++)
>  {
>    a[i]=-1;
>    scanf("%d%d",&x,&y);
>    if (x==y)
>      {
>       if (x%2==1)
>          a[i]=x+y+1;
>       else a[i]=x+y;
>       }
>     else if (x==y+2)
>            {
>               if (x%2==1)
>                  a[i]=x+y+1;
>               else a[i]=x+y;
>            }
> 
>  }
>   for(i=0;i<=k-1;i++)
>   {
>     if (a[i]!=-1)
>        printf("%d\n",a[i]);
>     else  printf("No Number\n");
>   }
>   return 0;
> }
将所有a[i]=x+y+1语句改为a[i]=x+y-1,试试看

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