/home/toolbox/public_html/solutions/108/10812/a.c
1 #include <stdio.h>
2 #include <string.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <fcntl.h>
6 #include <stdlib.h>
7 #include <math.h>
8 #include <stdint.h>
9
10 #define TRUE (1 == 1)
11 #define FALSE (1 != 1)
12
13 #define DEBUG if (FALSE)
14
15 /* fprintf(stderr, "functionName: message", varslist); */
16
17 /*
18 * Author: Isaac Traxler
19 * Date: 2015 02 11
20 * Purpose:
21 * Problem: 10812
22 */
23
24 /*
25 * This template reads data a specified number of times.
26 */
27
28 int numberOfTimes;
29 int diff;
30 int sum;
31
32 void init()
33 {
34 /* FUNCTION init */
35 scanf("%d ", &numberOfTimes);
36 } /* FUNCTION init */
37
38 void dump()
39 {
40 /* FUNCTION dump */
41 } /* FUNCTION dump */
42
43 void getInput()
44 {
45 /* FUNCTION getInput */
46 scanf(" %d %d ", &sum, &diff);
47 } /* FUNCTION getInput */
48
49 void process()
50 {
51 /* FUNCTION process */
52 int t;
53
54 /* impossible if diff is greater than sum or if sum-diff is odd */
55 if ((diff > sum) || (1 ==((sum-diff) % 2)))
56 {
57 /* impossible */
58 printf("impossible\n");
59 } /* impossible */
60 else
61 {
62 /* score is possible */
63 t = (sum - diff) / 2;
64 printf("%d %d\n", t+diff, t);
65 } /* score is possible */
66 } /* FUNCTION process */
67
68 int main()
69 {
70 /* main */
71 int i;
72
73 init();
74 for (i=0; i<numberOfTimes; i++)
75 {
76 /* while */
77 getInput();
78 process();
79 } /* while */
80
81 return EXIT_SUCCESS;
82 } /* main */
83
84