| ||||||||||
| 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:哪位高人指点一下啊...In Reply To:哪位高人指点一下啊... Posted by:snailly18 at 2006-07-21 21:12:32 > #include <stdio.h>
> #include<stdlib.h>
> void main()
> {
> int n;
> int *x,*y;
> int i=0;
> scanf("%d",&n);
> x=(int *)malloc(n*sizeof(int));
> y=(int *)malloc(n*sizeof(int));
> for(i=0;i<n;i++)
> {
> fflush(stdin);
> scanf("%d %d",&x[i],&y[i]);
> }
> for(i=0;i<n;i++)
> {
> if(x[i]!=y[i]&&x[i]!=y[i]+2)
> printf("No Number\n");
> if(x[i]==y[i])
> {
> if(x[i]%2==0)
> printf("%d\n",(x[i]/2)*4);
> else if(x[i]%2==1)
> printf("%d\n",(x[i]/2)*4+1);
> }
> else if(x[i]==y[i]+2)
> {
> if(y[i]%2==0)
> printf("%d\n",(y[i]/2)*4+2);
> else if(y[i]%2==1)
> printf("%d\n",(y[i]/2)*4+3);
> }
>
> }
> }
> 为什么wa啊?给祭祖错误数据也好啊.......
> 谢谢谢谢.........
代码太长 看晕了。。。
给您我的代码:
scanf("%d%d",&n,&m);
if ((n==m)||(n-2==m))
printf("%d\n",n+m-(n%2));
else
printf("No Number\n");
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator