Cod sursa(job #963311)
| Utilizator | Data | 17 iunie 2013 09:46:57 | |
|---|---|---|---|
| Problema | Deque | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
#include <fstream>
using namespace std;
ifstream f("celule.in");
ofstream g("celule.out");
int cmmdc(int a,int b)
{
while (a!=b)
if(a>b)
a=a-b;
else
b=b-a;
return a;
}
int sum(int a)
{
int i,s=0;
for(i=2; i*i<=a; i++)
while(a%i==0)
{
s=s+1;
a=a/i;
}
if(a!=1) s++;
return s;
}
int main()
{
int n,m,d;
f>>n>>m;
d=cmmdc(n,m);
g<<sum(n/d)+sum(m/d);
}
