Cod sursa(job #2823060)
| Utilizator | Data | 26 decembrie 2021 19:08:06 | |
|---|---|---|---|
| Problema | Deque | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.58 kb |
#include <bits/stdc++.h>
#define int long long
using namespace std;
ifstream fin ("ndiv.in");
ofstream fout ("ndiv.out");
int ans , a , b;
int solve (int x)
{
int p = 0 , d = 3 , ans = 1;
while (x % 2 == 0) x = x / 2 , p++;
ans = ans * (p + 1);
while (x > 1)
{
p = 0;
while (x % d == 0) x = x / d , p++;
if (p) ans = ans * (p + 1);
d = d + 2;
if (d * d > x && x > 1) d = x;
}
return ans;
}
signed main()
{
fin >> a >> b;
for (int i=a; i<=b; i++) ans = ans + solve(i);
fout << ans;
}
