NOI Contest Archive

Archive / 2023 / March 2023

Can you divide that

Medium · National Olympiad in Informatics Sri Lanka - March 2023

Sachin is an undergraduate that just learned what factorials are. Since he loved mathematics and wanted to learn more, his girlfriend Umayangani decided to give him a challenge.

Umayangani wrote down a bunch of numbers \(A = [x_1,x_2,x_3,...x_n]\) and gave Sachin another number \(y\). She challenged Sachin to find out quickly whether the sum of the factorials of the numbers in \(A\) is divisible by the factorial of \(y\)

If it is divisible, print yes. Otherwise print no

Input Format

the first line contains \(t\), the number of testcases.
then there are \(t\) occurences of

Output Format

\(t\) lines containing yes or no

Constraints

\[1 \le x_i,y \le 100\] \[1 \le t \le 1000\] \[1 \le n \le 111111\]

Time Limit: 2 seconds

Sample Input 0

2
2 5
7 7
7 5
4 2 1 7 5 4 3

Sample Output 0

yes
no