| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:各位大虾,为什么我的program出问题了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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator