Pagini recente » Cod sursa (job #390236) | Cod sursa (job #2399754) | Cod sursa (job #2199957) | Cod sursa (job #29405) | Cod sursa (job #2604767)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(), (a).end()
#define forn(i,a,b) for (int i = a; i <= b; i++)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define rc(s) return cout<<s,0
#define rcc(s) cout<<s,exit(0)
#define er erase
#define in insert
#define pi pair <int, int>
# define sz(x) (int)((x).size())
#define int long long
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const ll inf = 0x3f3f3f3f3f3f3f;
const ll mod = 1000000007;
const int N = 1000 + 11;
int n;
int gccd(int &x,int &y,int a,int b){
if(!b){
x = 1;
y = 0;
return a;
}
int xx,yy,d;
d = gccd(xx,yy,b,a%b);
x = yy;
y = xx - yy*(a/b);
return d;
}
int32_t main(){
ios_base::sync_with_stdio(0); cin.tie(0); cerr.tie(0); cout.tie(0);
ifstream cin("euclid3.in");
ofstream cout("euclid3.out");
int t;
cin>>t;
while(t--){
int a,b,c,x,y;
cin>>a>>b>>c;
int d = gccd(x,y,a,b);
int cur = c/d;
if(c%d){
cout<<"0 0"<<'\n';
}else{
cout<<x*cur<<' '<<y*cur<<'\n';
}
}
return 0;
}