Pagini recente » Cod sursa (job #326170) | Cod sursa (job #2070694) | Cod sursa (job #525861) | Cod sursa (job #3197382) | Cod sursa (job #659753)
Cod sursa(job #659753)
/*
* File: Sumasinumaruldivizorilor.cpp
* Author: slycer
*
* Created on January 10, 2012, 9:27 PM
*/
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <fstream>
using namespace std;
/*
*
*/
const int MOD = 9973;
int main(int argc, char** argv) {
ifstream input("ssnd.in");
ofstream output("ssnd.out");
int n;
input >> n;
for ( int i=0; i<n; i++ ){
long long c;
input >> c;
long long aux = c;
long long suma = 1;
long long produs = 1;
for ( int j=2; j*j<=c; j++ ){
int cnt=0;
long long factor = 1;
while ( aux % j == 0 ){
aux = aux/j;
cnt++;
factor = factor * j;
}
if ( cnt> 0 ){
factor = factor * j;
produs = produs * ( cnt + 1 );
factor = ( factor -1 )/( j - 1);
factor = factor % MOD;
suma = suma * factor;
suma = suma % MOD;
}
}
if ( aux > 1 ){
produs = produs * 2;
long long factor = ( aux * aux - 1 )/( aux - 1 );
factor = factor % MOD;
suma = ( suma * factor ) % MOD;
}
output << produs << " " << suma <<"\n";
}
return 0;
}