Pagini recente » Cod sursa (job #836110) | Monitorul de evaluare | Cod sursa (job #1702247) | Cod sursa (job #723071) | Cod sursa (job #2046328)
#include <bits/stdc++.h>
using namespace std;
int solve(int a, int b, int &x, int &y){
if(b == 0){
x = 1;
y = 0;
return a;
}
int x0, y0;
int ret = solve(b, a%b, x0, y0);
x = y0;
y = x0 - (a/b) * y0;
return ret;
}
int main()
{
int T;
cin >> T;
while(T--){
int a, b, c;
cin >> a >> b >> c;
int d, x, y;
d = solve(a, b, x, y);
if(c%d != 0){
cout << 0 << ' ' << 0 << '\n';
}else{
cout << 1LL * x * c / d << ' ' << 1LL * y * c / d << '\n';
}
}
return 0;
}