100. Ohm Sweet Ohm

Codeforces
IDCF10269100
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Ohm Sweet Ohm You have a circuit consisting of many resistors in parallel, and you want to calculate their equivalent resistance, in ohms. If you competed in our Contest #2 back in January, you might remember that the formula for calculating the equivalent resistance of two resistors in parallel with resistances $a$ and $b$ is $(a * b) \/ (a + b)$. To calculate the equivalent resistance of three parallel resistors, first calculate the equivalent resistance of the first two using the formula described above. Then, use the formula again to calculate the equivalent resistance of the third resistor and the value you just calculated, the equivalent resistance of the first two resistors. Calculating the equivalent resistance of more than three resistors works in a similar way. Formally, the equivalent resistance of $n$ resistors can be calculated by plugging in the equivalent resistance of the first $n -1$ resistors, and the resistance of the $n$th resistor, into the above formula. The first line of input contains a positive integer $n$ greater than one, indicating the number of resistors in the circuit. Assume that all of the resistors are in parallel with each other. The next line contains $n$ space-separated positive integers, each representing the resistance of a resistor in the circuit. Output a single positive decimal number: the equivalent resistance of the circuit. You don't need to (and you shouldn't) round your answer. ## Input The first line of input contains a positive integer $n$ greater than one, indicating the number of resistors in the circuit. Assume that all of the resistors are in parallel with each other. The next line contains $n$ space-separated positive integers, each representing the resistance of a resistor in the circuit. ## Output Output a single positive decimal number: the equivalent resistance of the circuit. You don't need to (and you shouldn't) round your answer. [samples]
**Definitions** Let $ n \in \mathbb{Z} $, $ n > 1 $, be the number of resistors. Let $ R = (r_1, r_2, \dots, r_n) $ be a sequence of positive real numbers representing the resistances. **Objective** Compute the equivalent resistance $ R_{\text{eq}} $ of $ n $ resistors in parallel, defined recursively by: $$ R_{\text{eq}} = \left( \sum_{i=1}^n \frac{1}{r_i} \right)^{-1} $$
API Response (JSON)
{
  "problem": {
    "name": "100. Ohm Sweet Ohm",
    "description": {
      "content": "Ohm Sweet Ohm You have a circuit consisting of many resistors in parallel, and you want to calculate their equivalent resistance, in ohms.  If you competed in our Contest #2 back in January, you mig",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269100"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Ohm Sweet Ohm\n\nYou have a circuit consisting of many resistors in parallel, and you want to calculate their equivalent resistance, in ohms. \n\nIf you competed in our Contest #2 back in January, you mig...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z} $, $ n > 1 $, be the number of resistors.  \nLet $ R = (r_1, r_2, \\dots, r_n) $ be a sequence of positive real numbers representing the resistances.\n\n**Objectiv...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments