Cod sursa(job #1478345)
| Utilizator | Data | 28 august 2015 14:23:25 | |
|---|---|---|---|
| Problema | Suma si numarul divizorilor | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.72 kb |
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
ifstream fin("ssnd.in");
ofstream out("ssnd.out");
void nrdiv(long n,long &nrdiv,long &s)
{
int k,i=2;
long nr=n;
while(n!=1)
{
k=0;
while(n%i==0)
{
k++;
n/=i;
}
if(k!=0)
nrdiv=nrdiv*(k+1);
i++;
}
for(i=1; i<=nr; i++)
if(nr%i==0)
s+=i;
}
int main()
{
int t,i;
long n,ct=0,s=0;
fin>>t;
for(i=0; i<t; i++)
{
fin>>n;
ct=1;
s=0;
nrdiv(n,ct,s);
out<<ct<<" "<<s%9973<<'\n';
}
fin.close();
out.close();
return 0;
}
