Pagini recente » Cod sursa (job #1003627) | Cod sursa (job #2977319)
#include <bits/stdc++.h>
using namespace std;
#if 1
#define cin fin
#define cout fout
ifstream fin("euclid3.in");
ofstream fout("euclid3.out");
#endif
#define ll int64_t
ll euc(ll a,ll b,ll& x,ll& y){
if(b==0){
x = 1;
y = 0;
return a;
}
ll d,x0,y0;
ll c = a/b;
d = euc(b,a%b,x0,y0);
x = y0;
y = x0 - c*y0;
return d;
}
void solve(){
ll a,b,c;
cin >> a >> b >> c;
ll x,y;
ll d = euc(a,b,x,y);
if(c%d==0){
ll cat = c/d;
cout << x*cat << " " << y*cat << "\n";
}
else
cout << "0 0\n";
}
int main(){
int t;
cin >> t;
while(t--){
solve();
}
}