RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00394

Otpor

Unrated 레이팅 미적용
난이도
1s
시간 제한
64MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(7^{th}\) round, March \(5^{th}\) 2016
Mirko has been a very good boy, so he got exactly what he wanted for his birthday, a "Young physicist"
kit! In the kit, there are \(N\) types of resistors, connecting wires and an ohmmeter. If a resistor is of
type \(i\), it provides a resistance of precisely \(R@@RISE_MATH_BLOCK_0@@2-R\)3-...-RK)
and the following formula holds:
\(R_{ekv} = R@@RISE_MATH_BLOCK_1@@2 + R\)3 + ... + \(R_{K}\)
When the circuit is parallel, it is written in the following way:
(R1|R2|R3|...|RK)
and the following formula holds:
\(R_{ekv}\) =
1
1
^{R}1 ^{+} ^{1}
^{R}2 ^{+} ^{1}
{R} {+}}^{+
1
\(RK\)
Mirko was excited to bring his new toy to school, where he showed it to all his friends. Unfortunately
for him, the teacher also noticed the toy. She quickly connected a circuit and is now asking Mirko to
tell her the equivalent resistance of the circuit. Help Mirko and answer the teacher’s question!

제약

In test cases worth 20% of total points, it will hold:
\(N = 3\)
• S is going to consist of exactly three resistors, \(R\)1, \(R\)2 and \(R\)3, not necessarily in that order
In test cases worth 40% of total points, S is going to have exactly one pair of brackets.

입력 형식

The first line of input contains the integer \(N\) (1 ⩽\(N\) ⩽9) from the task.
The following line contains \(N\) real numbers \(R_{i}\) (\(0 < R_{i} < 100\)) from the task.
The last line contains the circuit S, that will not be longer than 100 000 characters. S will only consist
of the following characters: ’R’, ’1’ – ’9’, ’(’, ’)’, ’-’ and ’|’. The number of pairs of brackets will be
minimal, and the brackets will be paired properly. Inside of a pair of brackets, there will not be the
character ’-’ and the character ’|’ at the same time. The circuit will only consist of the resistors from
the kit and it is possible that not all types of resistors are used, or that one type of resistor is used
several times.

출력 형식

The first and only line of output must contain the number from the task. A deviation from the official
solution of ±0.00001 is tolerated.

예제 1
입력
3
2 3 6
(R1-R2-R3)
3
2 3 6
(R1|R2|R3)
5
5.0 5.0 5.0 5.0 5.0
((R1-(R2|R3)-(R4|R5))|
(R1-(R2|R3)-(R4|R5)))
출력
output
output
11.00000
1.00000
5.00000
설명

Clarification of the third example: The circuit from the input is broken in two rows in order to maximize
readibility.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2015/2016 Contest 7

평가 및 의견

Otpor

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Otpor

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8