|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||256 MB||100||50||48||72.727%|
Your friend has come up with a math trick that supposedly will blow your mind. Intrigued, you ask your friend to explain the trick.
First, you generate a random positive integer k between 1 and 100. Then, your friend will give you n operations to execute. An operation consists of one of the four arithmetic operations
DIVIDE, along with an integer-valued operand x.
You are supposed to perform the requested operations in order. You don’t like dealing with fractions or negative numbers though, so if during the process, the operations generate a fraction or a negative number, you will tell your friend that he messed up.
Now, you know the n operations your friend will give. How many of the first 100 positive integers will cause your friend to mess up?
The first line of input contains a single positive integer n (1 ≤ n ≤ 10). Each of the next n lines consists of an operation, followed by an operand. The operation is one of the strings
DIVIDE. Operands are positive integes not exceeding 5.
Print, on a single line, a single integer indicating how many of the first 100 positive integers will result in you telling your friend that he messed up.
1 SUBTRACT 5
1 DIVIDE 2
2 ADD 5 DIVIDE 5