32 lines
599 B
C++
32 lines
599 B
C++
#include <iostream>
|
|
#include <math.h>
|
|
|
|
using namespace std;
|
|
|
|
void simplify(int x, int y) {
|
|
if (x == 0) {
|
|
y = 0;
|
|
}
|
|
else {
|
|
while (x % 10 == 0) {
|
|
x /= 10;
|
|
y += 1;
|
|
}
|
|
}
|
|
cout << x << " " << y << endl;
|
|
}
|
|
|
|
int main() {
|
|
int a1, b1, a2, b2, x, y;
|
|
cin >> a1 >> b1 >> a2 >> b2;
|
|
y = min(b1, b2);
|
|
x = a1 * pow(10, b1 - y) + a2 * pow(10, b2 - y);
|
|
simplify(x, y);
|
|
y = min(b1, b2);
|
|
x = a1 * pow(10, b1 - y) - a2 * pow(10, b2 - y);
|
|
simplify(x, y);
|
|
y = b1 + b2;
|
|
x = a1 * a2;
|
|
simplify(x, y);
|
|
return 0;
|
|
} |