给定 $n$,求一组合法解,使得 $frac{1}{x}+frac{1}{y}+frac{1}{z}=frac{2}{n}$
不妨令 $z=n$,则问题转化为 $frac{1}{x}+frac{1}{y}=frac{1}{n}$
根据我们在高中学习的 "裂项" 法,可知 $frac{1}{x+1}+frac{1}{x imes (x+1)}=frac{1}{x}$
那么直接让 $x=n$,$y=n imes (n+1)$ 即可.
#include <iostream> using namespace std; int main() { int n; cin>>n; if(n==1) cout<<-1<<endl; else { cout<<n<<" "<<n+1<<" "<<n*(n+1)<<endl; } return 0; }