Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C by BaiC ( 6 years ago )
#include <stdio.h>
long long int hoandoi(long long int n){
	long long int tong = 0, du;
	while(n != 0){
		du = n%10;
		n = n/10;
		tong = tong*10+du;
	}
	return tong;
}

int main(){
	long long int a, b;
	scanf("%lld%lld", &a, &b);
	b = hoandoi(b);
	int first = 0;
	long long int result = a, tonga = 0, tongb = 0;
	long long int dua, dub, A = a, B = b;
	long long int swapa, temp;
	while(a != 0){
		dua = a%10;
		dub = b%10;
		a = a/10;
		b = b/10;
		tonga = tonga*10+dua;
		swapa = hoandoi(tonga);
		tongb = tongb*10+dub;
//		printf("dub = %lld\n", dub);
//		printf("dua = %lld\n", dua);
//		printf("swapa = %lld\n", swapa);
//		printf("tongb = %lld\n", tongb);
		if((dua != dub) && (first == 0) && (A%100 != hoandoi(B%100))) result = result*10+dub;
		if((swapa != tongb) && (first == 1)){
			result = result*10+dub;
//			printf("kq = %d\n", result);
		}
		first = 1;		
	}
	printf("%lld", result);
	return 0;
}

 

Revise this Paste

Your Name: Code Language: