Last active
August 29, 2015 14:07
-
-
Save henrybear327/cce5bce85acae431820a to your computer and use it in GitHub Desktop.
ACM10812(using for).c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
/* | |
http://uva.onlinejudge.org/index.php?option=onlinejudge&Itemid=99999999&page=show_problem&category=&problem=1753&mosmsg=Submission+received+with+ID+14388286 | |
*/ | |
int main() | |
{ | |
int total_cases, count = 0, input_1, input_2; | |
scanf("%d", &total_cases); | |
for(count = 1; count <= total_cases; count++){ | |
scanf("%d %d", &input_1, &input_2); | |
if(input_1 < input_2 || (input_1 + input_2) % 2 != 0 || (input_1 - input_2) % 2 != 0){ | |
printf("impossible\n"); | |
continue; | |
} | |
printf("%d %d\n", (input_1 + input_2) / 2, (input_1 - input_2) / 2); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment