Search found 1 match

by rasel2707
Tue Feb 15, 2011 6:55 pm
Forum: Volume 108 (10800-10899)
Topic: 10812 - Beat the Spread!
Replies: 35
Views: 24842

Re: 10812 - Beat the Spread!

#include<stdio.h>
int main()
{
long int t, s, d, a, c;
scanf("%d",&t);
while(t--)
{
scanf("%d %d", &s, &d);
a = (s - d) / 2;
if((s%2==0 && d%2!=0) || (s%2!=0 && d%2==0) || (s-d)<0) printf("impossible\n");
else
{ if(a < s-a){ c = a; a = s - a; }
printf("%d %d\n", a, c);
}
}

return 0 ...

Go to advanced search