Pagini recente » Cod sursa (job #680596) | Cod sursa (job #2893545) | Cod sursa (job #817645) | Cod sursa (job #937672) | Cod sursa (job #2685154)
#include <bits/stdc++.h>
//#pragma GCC optimize ("03")
#define FastIO ios_base::sync_with_stdio(false) , cin.tie(0) , cout.tie(0)
#define FILES freopen("euclid3.in" , "r" , stdin) , freopen("euclid3.out" , "w" , stdout)
#define ll long long
#define ull unsigned long long
#define ld long double
#define eb emplace_back
#define pb push_back
#define qwerty1 first
#define qwerty2 second
#define qwerty3 -> first
#define qwerty4 -> second
#define umap unordered_map
#define uset unordered_set
#define pii pair < ll , ll >
#define pq priority_queue
#define dbg(x) cerr << #x << ": " << x << '\n'
namespace FastRead
{
char buff[5000];ll lg = 0 , p = 0;
char nc()
{
if(lg == p){lg = fread(buff , 1 , 5000 , stdin);p = 0;if(!lg) return EOF;}
return buff[p++];
}
template<class T>void read(T&x)
{
T sgn = 1; char c;while(!isdigit(c = nc()))if(c == '-')sgn = -1;
x = c - '0';while(isdigit(c = nc()))x = x * 10 + c - '0';x *= sgn;
}
}
using namespace FastRead;
using namespace std;
const ll N = 3e5 + 10;
const ll M = 1e9 + 7;
const ld PI = acos(-1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll a , b , c;
ll euclid(ll A , ll B , ll &X , ll &Y)
{
if(B == 0)
{
X = 1;
Y = 0;
return A;
}
ll X0 , Y0;
ll D = euclid(B , A % B , X0 , Y0);
X = Y0;
Y = X0 - A / B * Y0;
return D;
}
signed main()
{
#ifndef ONLINE_JUDGE
FastIO , FILES;
#endif
ll q; cin>>q;
while(q--)
{
cin >> a >> b >> c;
ll x , y;
ll d = euclid(a , b , x , y);
if(c % d)
cout << "0 0\n";
else cout << x * c / d << ' ' << y * c / d << '\n';
}
return 0;
}