Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
564 B
4
Indexable
#include<stdio.h>
#include<string.h>
#include<math.h>
int min(int n){
	int x=0;
	int y=0;
	while (n>0){
		if(n%10==6){
			x=5*pow(10,y)+x;
		}
		else x=n%10*pow(10,y)+x;
		
		n=n/10;
		y++;
	}
	return x;
}
int max(int n){
	int x=0;
	int y=0;
	while (n>0){
		if(n%10==5){
			x=6*pow(10,y)+x;
		}
		else x=n%10*pow(10,y)+x;
		
		n=n/10;
		y++;
	}
	return x;
}
int main(){
	int j,x;
	scanf("%d",&j);
	
	for(x=1;x<=j;x++){
		int a,b;
		scanf("%d%d",&a,&b);
		printf("%d %d\n",min(a)+min(b),max(a)+max(b));
		
	}

	return 0;
}