Pagini recente » Cod sursa (job #308434) | Cod sursa (job #1556601) | Cod sursa (job #1542778) | Cod sursa (job #3039779) | Cod sursa (job #2848093)
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define FASTIO ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0)
ifstream fin("euclid3.in");
ofstream fout("euclid3.out");
#define LL long long
#define pii pair<int , int>
#define sz(a) ((int)((a).size()))
const unsigned int MAX = 1e2+1;
inline void euclid(LL a , LL b ,LL & d, LL & x ,LL & y)
{
if(b == 0)
{
d = a;
x = 1, y = 1;
}
else
{
LL x1 , y1;
euclid(b , a % b , d, x1 , y1);
x = y1;
y = x1 - a / b * y1;
}
}
LL T;
int32_t main()
{
FASTIO;
fin>>T;
while(T--)
{
LL a, b , c;
LL x1=0 , x2 =0, d;
fin>>a>>b>>c;
d = __gcd(a,b);
if(c%d==0)
{
euclid(a,b,d,x1,x2);
fout<<x1*c/d<<' '<<x2*c/d<<'\n';
}
else
fout<<0<<' '<<0<<'\n';
}
}