Pagini recente » Cod sursa (job #530060) | Cod sursa (job #789436) | Cod sursa (job #1310331) | Cod sursa (job #970917) | Cod sursa (job #3134788)
#include <iostream>
using namespace std;
int d,a,b,c;
inline int cmmdc(int &x, int &y )
{
if (b == 0){
x = 1;
y = 0;
return a;
}
int x0, y0;
d = cmmdc(x0, y0);
x = y0;
y = x0 - (a / b) * y0;
return d;
}
int main(){
freopen("euclid3.in", "rt", stdin);
freopen("euclid3.out", "wt", stdout);
int t;
cin >> t;
for (int i =0 ; i < t; i++){
cin >>a>>b>>c;
int x, y;
d = cmmdc(x, y);
if (c % d)
cout << "0 0" <<endl;
else
cout << x * (c / d)<< " "<< y * (c / d)<< endl;
}
return 0;
}