Cod sursa(job #1768315)
Utilizator | Data | 30 septembrie 2016 17:59:50 | |
---|---|---|---|
Problema | Dreptunghiuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.3 kb |
#include <fstream>
using namespace std;
ifstream f ("dreptunghi.in");
ofstream g ("dreptunghi.out");
int main()
{int N, M, r, nrop=0, aux;
f>>N>>M;
if (M,N) {aux=N;
N=M;
M=aux;
}
while(N>0){
nrop=nrop+N*(M/N);
r=M%N;
M=N;
N=r;
} g<<nrop;
return 0;
}