All submissions for this problem are available.
In the game of Crumbling Numbers you will be given a number followed by some operations which are to be performed on this number. Once the operations start, if at any point the number is divisible by a prime number P(5<P<10000), other than itself, then the number becomes the largest integer smaller than the quotient after division by the prime number. If it is divisible by multiple prime numbers you must divide by the largest prime number.
In case it is not meet the condition stated above, add the "answer to life, the universe and everything"+1 to the current number. After all queries are completed, if the number is the "answer to life, the universe and everything"+1 then output YES, otherwise output NO.
Input starts with T on one line stating the number of test cases. Each test case will start N and Q on a line stating the number and number of operations respectively. Then Q operations follow.
Operations are addition(+), subtraction(-), multiplication(*), division(/) and modulo(%).
N will always be less than 2147483647 and greater than -2147483647.
After division N always becomes the largest integer <= the quotient.
Division and Modulo will always be with number greater than 0.
For each test case output either a YES or a NO on a new line.
Input: 2 49 6 + 19 / 7 * 357 % 42 + 63 - 21 1 7 + 19 / 7 * 357 % 42 + 63 - 21 -20 Output: NO YES
|Time Limit:||0.214286 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.