[Solution] Factorial Divisibility Codeforces Solution
D. Factorial Divisibility
time limit per test
2 secondsmemory limit per test
256 megabytesinput
standard inputoutput
standard outputYou are given an integer and an array of integers . You have to determine if the number is divisible by .
Here is a factorial of — the product of all positive integers less than or equal to . For example, , and .
Input
The first line contains two integers and (, ).
The second line contains integers () — elements of given array.
Output
In the only line print "Yes" (without quotes) if is divisible by , and "No" (without quotes) otherwise.
Note
In the first example . Number is divisible by .
In the second example , is divisible by .
In the third example . It is easy to prove that this number is not divisible by .
No comments:
Post a Comment