Cod sursa(job #2705006)
Utilizator | Data | 11 februarie 2021 19:39:46 | |
---|---|---|---|
Problema | Mins | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include <fstream>
using namespace std;
ifstream in("mins.in");
ofstream out("mins.out");
int main()
{
int s,a,b,x,y,k=1,cmmmc;
in>>a>>b;
x=a;
y=b;
while(y)
{
s=x%y;
x=y;
y=s;
}
cmmmc=(a*b)/x;
s=cmmmc/a-1+cmmmc/b-1;
out<<s;
return 0;
}