Pagini recente » Cod sursa (job #105013) | Cod sursa (job #1919125) | Cod sursa (job #1841901) | Cod sursa (job #699710) | Cod sursa (job #1739388)
#include <fstream>
using namespace std;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
const int mod = 9973;
long long Power(long long a, long long b)
{
long long x, i;
x = a;
for (i = 2; i <= b; ++ i)
a *= x;
return a;
}
void Solve(long long x)
{
long long sum, nrdiv, ct, d;
ct = 0;
while (x % 2 == 0)
{
++ ct;
x /= 2;
}
nrdiv = ct + 1;
sum = ((Power(2, ct + 1) - 1) / (2 - 1)) % mod;
d = 3;
while (d * d <= x)
{
ct = 0;
while (x % d == 0)
{
++ ct;
x /= d;
}
if (ct)
{
nrdiv *= ct + 1;
sum *= ((Power(d, ct + 1) - 1) / (d - 1)) % mod;
}
d += 2;
}
if (x != 1)
{
nrdiv *= 2;
sum *= ((Power(x, 2) - 1) / (x - 1)) % mod;
}
fout << nrdiv << " " << sum % mod << "\n";
}
int main()
{
long long n, x, i;
fin >> n;
for (i = 1; i <= n; ++ i)
{
fin >> x;
Solve(x);
}
fin.close();
fout.close();
return 0;
}