13分求助!谢谢。
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int a,b,c,g;
cin>>a>>b>>c;
g=__gcd(b,a);
b/=g,a/=g;
if(a<b){
cout<<b*ceil((double)c/a)+a*ceil((double)c/a)<<endl;
}else cout<<b*ceil((double)c/b)+a*ceil((double)c/b)<<endl;
}
}