
Agama
5 год назад
С++ ( Пожалуйста посчитайте СРОЧНО )

ОТВЕТЫ

Artur
Oct 24, 2020
#include <bits/stdc++.h>
using namespace std;
int count_of_divisors(int n)
{
int res = 0;
for (int i = 2; i * i <= n; ++i)
if (n % i == 0)
res += 2 - (i *i == n);
return res + 2 - (n == 1);
}
int main()
{
int n;
cin >> n;
cout << count_of_divisors(n) << endl;
}
//Ассимптотика O(log(n));
using namespace std;
int count_of_divisors(int n)
{
int res = 0;
for (int i = 2; i * i <= n; ++i)
if (n % i == 0)
res += 2 - (i *i == n);
return res + 2 - (n == 1);
}
int main()
{
int n;
cin >> n;
cout << count_of_divisors(n) << endl;
}
//Ассимптотика O(log(n));
135
Смежные вопросы: