013. Resistors in Parallel
013. Resistors in Parallel
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
When two resistors with resistances a and b are parallel in an electronic circuit, their equivalent resistance is calculated as (a * b) / (a + b). Given the resistances of two resistors, calculate their equivalent resistance.
Input
The first line of input contains a single positive integer a: the resistance of the first resistor. The second line of input contains a single positive integer b: the resistance of the second resistor.
Output
Output a single positive decimal number r: the equivalent resistance of the two resistors, calculated using the above formula.
Examples
input
Copy
60 40
output
Copy
24.0
input
Copy
80 70
output
Copy
37.333333333333336
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p=int(input()) | |
q=int(input()) | |
print((p*q)/(p+q)) |
Comments
Post a Comment
Please give us your valuable feedback