Pagini recente » Cod sursa (job #1625645) | Cod sursa (job #446053) | Cod sursa (job #667080) | Cod sursa (job #132355) | Cod sursa (job #972753)
Cod sursa(job #972753)
#include <fstream>
#include <cmath>
#include <vector>
#define max 100000
std::vector<int> myV;
void make()
{
bool bC[max];
for(int i(0); i < max; i++)
bC[i] = true;
for(int i = 2; i <= sqrt(max); i++)
if(bC[i])
for(int j = i * i; j < max; j += i)
bC[j] = false;
for(int i = 2; i < max; i++)
if(bC[i]) myV.push_back(i);
}
int main(void)
{
make();
std::ofstream out("ssnd.out");
std::ifstream in("ssnd.in");
int nV;
in >> nV;
long long unsigned nB;
for(int i = 0; i < nV; i++)
{
in >> nB;
long long unsigned sum(1);
long long unsigned prod(1);
long long unsigned cop = nB;
for(unsigned j(0); j < myV.size(); j++)
{
if((long long unsigned)nB % myV[j] != 0) continue;
int k(1);
long long unsigned l(myV[j]);
while((long long unsigned)cop % myV[j] == 0)
{
cop /= myV[j];
l *= myV[j];
k++;
}
sum *= k;
prod *= (l - 1) / (myV[j] - 1);
}
if(sum == 1) sum++;
if(prod == 1) prod += nB;
out << sum << ' ' << prod << "\n";
}
return 0;
}