Number of Divisors
EasyPractice library · +10 XPmathnumber theory
Given a positive integer N, print the total count of its positive divisors. For example, the divisors of 12 are 1, 2, 3, 4, 6, and 12, so the count is 6.
Input
A single line containing the positive integer N.
Output
A single line containing the count of divisors of N.
Constraints
1 <= N <= 1000
Time limit 1 s (native code; slower languages get more)Memory 256 MB12 hidden tests
Example 1
Input
12
Output
6
The divisors of 12 are 1, 2, 3, 4, 6, 12. The count is 6.
Example 2
Input
7
Output
2
The divisors of 7 are 1, 7. The count is 2.
Hints
# Read the input from stdin and print the answer.
import sys
def main():
data = sys.stdin.read().split()
# your code here
main()
Example 1 input
12
Example 2 input
7