PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000206. Số ước của đa giai thừa (Multifactorials)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Số ước của đa giai thừa (Multifactorials)
Số ước của đa giai thừa (Multifactorials)
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Given integer and a string of exclamation marks !, the order- multifactorial equals , stopping before a nonpositive term. Count its distinct positive divisors. If the count is greater than , print Infinity; otherwise print the exact count.
Input
One line with integer , a space and a string of 1 to 20 ! characters.
Output
Print the exact number of positive divisors, or Infinity.
Subtasks
-
Subtask 1 (20 points): ; (chuỗi gồm dấu
!). -
Subtask 2 (30 points): ; (chuỗi gồm dấu
!). -
Subtask 3 (50 points): ; (chuỗi gồm dấu
!).
Examples
Example 1
Input
4 !!
Output
4
Explanation
4!!=4*2=8, which has four positive divisors.
Example 2
Input
6 !!!
Output
6
Explanation
6!!!=6*3=18, which has six positive divisors.
Example 3
Input
5 !
Output
16
Explanation
5!=120=2^335, which has 16 positive divisors.