Untitled

mail@pastecode.io avatar
unknown
c_cpp
a year ago
721 B
1
Indexable
Never
#include <iostream>
#include <cmath>
using namespace std;

int main() {

	int a, b,max,min,max_len,min_len;
	double result = 0;
	
	cin >> a >> b;
	
	int len_a = 0;
	int copy_a = a;
	while (copy_a != 0) {
		len_a += 1;
		copy_a /= 10;
	}
	
	int len_b = 0;
	int copy_b = b;
	while (copy_b != 0) {
		len_b += 1;
		copy_b /= 10;
	}

	if (len_a != len_b) {
		if (len_a > len_b) {
			max_len = len_a;
			min_len = len_b;
			max = a;
			min = b;
		}
		else {
			max_len = len_b;
			min_len = len_a;
			max = b;
			min = a;
		}
		result = min * pow(10, (max_len - min_len)) + (max % (int)pow(10, (max_len - min_len)));
	}
	else {
		result = a * pow(10,len_b) + b;
	}
	cout << result;
}