原式即:
然后三个未知量不行,令 ,则右式等于 ,那么左式也要是 的倍数。
这样就只用暴力枚举 ,计算出左式为 ,是 的倍数的话,, 就都出来了。
能取到哪里
再写个代码,打表。
设 (),对于 ,求出此时 的取值,可以发现最多到 。
对于 , 取 ,对于 , 取 。
代码:
#include<bits/stdc++.h>
#define int long long
//#define double long double
//#define debug(x) cout<<#x<<"->"<<x<<endl<<flush
//#define endl '\n'
//#define inf INT_MAX
using namespace std;
const int N=1e2+7;
const int M=1e2+7;
const int mod=1e9+7;
void solve(){
int a;cin >>a;
/*
a+b-gcd(a,b)=lcm(c,d)-c-d
c=3k,d=4k
lcm(c,d)-c-d=5k
*/
for(int b=1,c,d;;b++){
int k=a+b-__gcd(a,b);//算出 k
if(k%5==0){
//t=k/5,t 出来了
c=k/5*3;d=k/5*4;//算出 c,d
cout<<b<<" "<<c<<" "<<d<<"\n";
return;
}
}
}
signed main(){
ios::sync_with_stdio(0);
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int t;cin >>t;while(t--)solve();
return 0;
}