Mai intai trebuie sa te autentifici.
Cod sursa(job #2980143)
Utilizator | Data | 16 februarie 2023 11:01:12 | |
---|---|---|---|
Problema | Litere | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.77 kb |
#include <iostream>
using namespace std;
int nrprim(int n)
{
int d=2,k=0;
while(n>1)
{
if(n%d==0)
{
k++;
while(n%d==0)
n/=d;
}
if(d*d>n and n>1)
d=n;
else
d++;
}
return k;
}
long long x,y,nrmaxim,maxim;
int main()
{
cin>>x>>y;
if(x==y)
cout<<x<<" "<<nrprim(x);
else
{
while(x!=y)
{
if(nrprim(x)>maxim)
{
nrmaxim=0;
maxim=nrprim(x);
}
if(nrprim(x)==maxim and x>nrmaxim)
nrmaxim=x;
x=y;
cin>>y;
}
cout<<nrmaxim<<" "<<maxim;
}
return 0;
}