Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
600 B
0
Indexable
Never
#include <iostream>

int main() {
	int t = 0;
	int x = 0;
	int changedX = 0;
	int y = 0;
	int changedY = 0;
	int resA = 0;
	int resB = 0;
	std::cin >> t;

	for (int i = 0; i < t; i++) {
		std::cin >> x >> y;
		for (int a = 1; a < 100; a++) {
			for (int b = 1; b < 100; b++) {
				changedX = x;
				for (int j = 0; j < a; j++) {
					changedX *= b;
					if (changedX == y) {
						std::cout << a << ' ' << b;
						break;
					}
				}

				if (changedX == y) {
					break;
				}
			}

			if (changedX == y) {
				break;
			}
		}		
	}
	std::cout << 0 << ' ' << 0;
}
Leave a Comment