Pagini recente » Cod sursa (job #470801) | Cod sursa (job #601684) | Cod sursa (job #2427003) | Cod sursa (job #1901682) | Cod sursa (job #3228561)
// Osztók száma és összege.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <cmath>
#include <fstream>
#include <filesystem>
using namespace std;
int main()
{
ifstream f("ssnd.in");
ofstream g("ssnd.out");
int t;
f >> t;
for (int ti = 1; ti <= t; ti++) {
long long alapok[40]{ 0 };
long long kitevok[40]{ 0 };
long long n, szamuk = 1, hany = 0, osszeg = 1;
f >> n;
if (n % 2 == 0) {
alapok[1] = 2;
hany++;
do
{
n = n / 2;
kitevok[1]++;
} while (n % 2 == 0);
}
for (int i = 3; i <= sqrt(n); i = i + 2)
{
if (n % i == 0) {
hany++;
alapok[hany] = i;
do
{
n = n / i;
kitevok[hany]++;
} while (n % i == 0);
}
}
if (n > 2) {
hany++;
alapok[hany] = n;
kitevok[hany] = 1;
}
for (int i = 1; i <= hany; i++) {
szamuk = szamuk * (kitevok[i] + 1);
}
long long mod = 9973;
for (int i = 1; i <= hany; i++)
{
long long aktualis = 1, s = 1;
for (int y = 1; y <= kitevok[i]; y++) {
aktualis = aktualis * alapok[i] % mod;
s = (s + aktualis) % mod;
}
osszeg = (osszeg * s) % mod;
}
g << szamuk << " ";
g << osszeg << endl;
}
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file