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

4227번 - Smeech 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB96382738.028%

문제

Professor Octastichs has invented a new programming language, Smeech. An expression in Smeech may be a positive or negative integer, or may be of the form (p e1 e2) where p is a real number between 0 and 1 (inclusive) and e1 and e2 are Smeech expressions. The value represented by a Smeech expression is as follows:

  • An integer represents itself
  • With probability p, (p e1 e2) represents x+y where x is the value of e1 and y is the value of e2; otherwise it represents x-y.

Given a Smeech expression, what is its expected value?

입력

Input consists of several Smeech expressions, one per line, followed by a line containing ().

출력

For each expression, output its expected value to two decimal places.

제한

예제 입력 1

7
(.5 3 9)
()

예제 출력 1

7.00
3.00

힌트

출처

Contest > Waterloo's local Programming Contests > 29 September, 2007 B번

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

출처

대학교 대회

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

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