| ||||||||||
| 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 | |||||||||
太假了,浪费我的WA这样能过:
#include<stdio.h>
int main()
{
int n,s,d;
scanf("%d",&n);
while(n--)
{
scanf("%d%d",&s,&d);
if(s<d||(s-d)%2||(s+d)%2) printf("impossible\n");
else
{
int a=(s+d)/2;
int b=(s-d)/2;
printf("%d %d\n",a,b);
}
}
return 0;
}
这样却WA:
#include<stdio.h>
int main()
{
int n,s,d;
scanf("%d",&n);
while(n--)
{
scanf("%d%d",&s,&d);
if(s<d+2||(s-d)%2||(s+d)%2) printf("impossible\n");
else
{
int a=(s+d)/2;
int b=(s-d)/2;
printf("%d %d\n",a,b);
}
}
return 0;
}
郁闷啊,不得其解
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator