Logo
(追記) (追記ここまで)

11605번 - Magic Trick 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB38422518863.300%

문제

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 ADD, SUBTRACT, MULTIPLY, or 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 ADD, SUBTRACT, MULTIPLY, or 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

1
SUBTRACT 5

예제 출력 1

4

예제 입력 2

1
DIVIDE 2

예제 출력 2

50

예제 입력 3

2
ADD 5
DIVIDE 5

예제 출력 3

80

힌트

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2015 Pacific Northwest Region Programming Contest > Division 2 M번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /