#15346: c answer


blackconqueror (boweichen)

學校 : 國立臺南第一高級中學
編號 : 58182
來源 : [220.132.250.41]
最後登入時間 :
2020-06-01 10:17:42
c004. 10812 - Beat the Spread! -- UVa10812 | From: [140.114.197.199] | 發表日期 : 2018-09-29 21:02

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
int n;
while(scanf("%d",&n)!=EOF){
int s,d;
while(scanf("%d %d",&s,&d)!=EOF){
if(s<d||(s+d)%2==1){
printf("impossible\n");
}else{
if((s+d)>(s-d)){
printf("%d %d\n",(s+d)/2,(s-d)/2);
}else{
printf("%d %d\n",(s-d)/2,(s+d)/2);
}
}
}
}
return 0;
}

 
ZeroJudge Forum