A - Equivalent Resistance
Editorial
/
Time Limit: 2 sec / Memory Limit: 256 MB
配点 : 100 点
問題文
電気回路において、抵抗値が R_1 の抵抗と抵抗値が R_2 の抵抗を並列につないだとき、合成抵抗 R_3 は以下の関係式から求めることが出来ます。
- \frac{1}{R_1} + \frac{1}{R_2} = \frac{1}{R_3}
R_1 と R_2 が与えられるので R_3 を求めてください。
制約
- 1 \leq R_1, R_2 \leq 100
- R_1, R_2 は整数
入力
入力は以下の形式で標準入力から与えられる。
R_1 R_2
出力
R_3 の値を出力せよ。
絶対誤差または相対誤差が 10^{-6} 以下ならば正解となる。
入力例 1
2 3
出力例 1
1.2000000000
入力例 2
100 99
出力例 2
49.7487437186
Score : 100 points
Problem Statement
In an electric circuit, when two resistors R_1 and R_2 are connected in parallel, the equivalent resistance R_3 can be derived from the following formula:
- \frac{1}{R_1} + \frac{1}{R_2} = \frac{1}{R_3}
Given R_1 and R_2, find R_3.
Constraints
- 1 \leq R_1, R_2 \leq 100
- R_1 and R_2 are integers.
Input
The input is given from Standard Input in the following format:
R_1 R_2
Output
Print the value of R_3.
The output is considered correct if the absolute or relative error is at most 10^{-6}.
Sample Input 1
2 3
Sample Output 1
1.2000000000
Sample Input 2
100 99
Sample Output 2
49.7487437186