Cod sursa(job #3330872)
| Utilizator | Data | 22 decembrie 2025 18:21:39 | |
|---|---|---|---|
| Problema | Suma si numarul divizorilor | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.75 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("ssnd.in");
ofstream out("ssnd.out");
int MOD = 9973;
int lg_put(int a, int b) {
int rez = 1;
while(b > 0) {
if(b % 2 == 1) {
rez = 1LL * rez * a % MOD;
}
a = 1LL * a * a % MOD;
b /= 2;
}
return rez;
}
int main(){
int t,n;
in >> t;
for(int i = 0 ; i < t; i++){
in >> n;
int d = 2,e = 0,card = 1, s=1;
while(n>1){
while(n%d==0){
n/=d;
e++;
}
e+=1;
card*=e;
s*= (lg_put(d,e)-1)/(d-1);
e=0;
d++;
}
out << card <<" " << s<<'\n';
}
}