PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000180. Kiểm tra chia hết cho giai thừa (Factovisors)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Kiểm tra chia hết cho giai thừa (Factovisors)
Factovisors
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Given two nonnegative integers and , define the factorial by
Determine whether divides , meaning that an integer exists such that .
In particular, does not divide any factorial, while divides every factorial, including .
Print the conclusion using exactly one of the two formats specified below.
Input
One line containing two nonnegative integers and .
Output
If , print exactly <m> divides <n>!; otherwise print <m> does not divide <n>!. Replace <m> and <n> with their numeric values.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
6 9
Output
9 divides 6!
Explanation
, so divides and the first output format applies.
Example 2
Input
6 27
Output
27 does not divide 6!
Explanation
leaves remainder upon division by , so the second output format applies.