Pagini recente » Cod sursa (job #2119391) | Cod sursa (job #1831511) | Cod sursa (job #2845815) | Cod sursa (job #2232275) | Cod sursa (job #2566352)
#include <fstream>
#include <vector>
#include <queue>
using namespace std;
const int CMAX = 1e6;
const int CLOG = 1e3;
const long long MOD = 9973;
ifstream cin("ssnd.in");
ofstream cout("ssnd.out");
bool c[CMAX + 5];
vector <int> prime;
vector <pair <int, int> > diviz;
queue < pair <long long, int> > q;
void ciur()
{
c[0] = c[1] = 1;
for(int i = 4; i <= CMAX; i += 2) {
c[i] = 1;
}
for(int i = 3; i <= CLOG; i += 2) {
if(c[i] == 0) {
for(int j = i * i; j <= CMAX; j += 2 * i) {
c[j] = 1;
}
}
}
prime.emplace_back(2);
for(int i = 3; i <= CMAX; i += 2) {
if(c[i] == 0) {
prime.emplace_back(i);
}
}
}
int main() {
ciur();
int t;
cin >> t;
for(int test = 1; test <= t; ++test) {
diviz.clear();
long long n;
cin >> n;
long long cn = n;
for(int i = 0; i < prime.size() && prime[i] * prime[i] <= n; ++i) {
int e = 0;
while(cn > 1 && cn % prime[i] == 0) {
e++;
cn /= prime[i];
}
if(e > 0) {
diviz.emplace_back(prime[i], e);
}
if(cn <= 1)
break;
}
if(cn > 1) {
diviz.emplace_back(n, 1);
}
int nrdiviz = 1;
for(auto x: diviz) {
nrdiviz *= (x.second + 1);
}
q.emplace(1, 0);
int curr = 1;
for(auto x: diviz) {
while(q.front().second == curr - 1) {
auto elem = q.front();
q.pop();
long long px = 1;
for(int i = 0; i <= x.second; ++i) {
q.emplace(elem.first * px, curr);
px *= x.first;
}
}
curr++;
}
long long sumdiviz = 0;
while(!q.empty()) {
sumdiviz = (sumdiviz + q.front().first) % MOD;
q.pop();
}
cout << nrdiviz << " " << sumdiviz << "\n";
}
return 0;
}