Cod sursa(job #2251221)

Utilizator robertbirsanRobert Birsan robertbirsan Data 1 octombrie 2018 11:50:24
Problema A+B Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <Fstream>

using namespace std;

int main()
{ int n,p,k,i,s=0;
    ifstream f("cufar.in");
    ofstream g("cufar.out");
    f>>p>>n;
    i=2;
    while(n>1)
    if(n%i==0)
    {
        k=0;
        while(n%i==0)
        {
            k++;
            n=n/i;
            s=s+k;
        }
    }
    if(p==1)
        g<<k;
    else
    {
        if(p==2)
            g<<s;
    }
    return 0;
}