Codeforces•Jun 29, 2025
LCM
Hazrat Ali
Codeforces
Ivan has number bb. He is sorting through the numbers aa from 1 to 10, and for every aa writes [a,b]a[a,b]a on black board. Here [a,b][a,b] stands for least common multiple of aa and bb. Ivan is very lazy, that's why this task bored him soon. But he is interested in how many different numbers he would write on the board if he would finish the task. Help him to find the quantity of different numbers he would write on the board.
Input
The only line contains one integer b (1≤b≤10)
Output
Print one number answer for the problem.
Examples
Input
1
Output
1
Input
2
Output
2
Solution
#include <bits/stdc++.h>
using namespace std;
int main() {
long long b;
cin >> b;
set<long long> s;
for (long long i = 1; i * i <= b; i++) {
if (b % i == 0) {
s.insert(i);
s.insert(b / i);
}
}
cout << s.size() << endl;
return 0;
}