Cod sursa(job #2812660)
| Utilizator | Data | 4 decembrie 2021 21:16:52 | |
|---|---|---|---|
| Problema | Suma si numarul divizorilor | Scor | 70 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.64 kb |
#include <fstream>
using namespace std;
int t;
long long n;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
void calcul(long long n){
long long suma = 1+n;
int nrdiv = 2;
for(long long d = 2; d*d <= n; d++){
if(n%d == 0){
suma += d;
suma %= 9973;
nrdiv++;
if(d != n/d){
suma += n/d;
suma %= 9973;
nrdiv++;
}
}
}
fout << nrdiv << " " << suma << "\n";
}
int main()
{
fin >> t;
for(int i = 1; i <= t; i++){
fin >> n;
calcul(n);
}
return 0;
}
