Pagini recente » Cod sursa (job #2831393) | Cod sursa (job #530213) | Cod sursa (job #2448258) | Cod sursa (job #24099) | Cod sursa (job #2667397)
//ssense
#include<bits/stdc++.h>
//#include "/Users/mihaiesanu/testlib.h"
#define startt ios_base::sync_with_stdio(false);cin.tie(0);
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
#define FOR(n) for(int i=0;i<n;i++)
#define vt vector
#define sz(a) (int)a.size()
#define MOD 1000000007
#define MOD2 998244353
#define MX 1000000000
#define NMAX 100005
#define MXL 1000000000000000000
#define PI 3.14159265
#define pb push_back
#define pf push_front
#define sc second
#define endl '\n'
#define fr first
#define int ll
#define ld long double
int gcdEX(int a, int b, int& x, int& y) {
if (b == 0) {
x = 1;
y = 0;
return a;
}
int x1, y1;
int d = gcdEX(b, a % b, x1, y1);
x = y1;
y = x1 - y1 * (a / b);
return d;
}
bool find_any_solution(int a, int b, int c, int &x0, int &y0, int &g) {
g = gcdEX(abs(a), abs(b), x0, y0);
if (c % g) {
return false;
}
x0 *= c / g;
y0 *= c / g;
if (a < 0) x0 = -x0;
if (b < 0) y0 = -y0;
return true;
}
int32_t main(){
startt
freopen("euclid3.in","r",stdin);
freopen("euclid3.out","w",stdout);
int t;
cin >> t;
while(t--)
{
int a,b ,c;
cin >> a >> b >> c;
int x, y;
int g = gcdEX(a, b, x, y);
if(c%g != 0)
{
cout << "0 0" << endl;
continue;
}
cout << x << " " << y << endl;
}
}