E. Resistors in Parallel

Codeforces
IDCF10202E
Time2000ms
Memory1024MB
Difficulty
English · Original
Formal · Original
In this physics problem, what we are concerned about are only resistors. If you are poor at physics, do not worry, since solving this problem does not require you to have advanced abilities in physics. Resistors are said to be connected together in parallel when both of their terminals are respectively connected to each terminal of the other resistors. We have the following parallel resistor equation for k resistors with resistances R1, R2, ..., Rk in parallel and their combined resistance R: Now you have n resistors, the i-th of which has a resistance of ri ohms with the equation You also have n selections, the i-th of which is a set of resistors Si such that Please find a selection in which the resistors form a parallel resistor with the minimum resistance and output the reduced fraction of its resistance. The input contains several test cases, and the first line contains a positive integer T indicating the number of test cases which is up to 100. For each test case, the only one line contains an integer n, where 1 ≤ n ≤ 10100. For each test case, output a line containing a reduced fraction of the form _p/q_ indicating the minimum possible resistance, where _p_ and _q_ should be positive numbers that are coprime. ## Input The input contains several test cases, and the first line contains a positive integer T indicating the number of test cases which is up to 100.For each test case, the only one line contains an integer n, where 1 ≤ n ≤ 10100. ## Output For each test case, output a line containing a reduced fraction of the form _p/q_ indicating the minimum possible resistance, where _p_ and _q_ should be positive numbers that are coprime. [samples]
**Definitions** Let $ T \in \mathbb{Z}^+ $ be the number of test cases. For each test case: - Let $ n \in \mathbb{Z}^+ $ be the number of resistors. - Let $ R = \{ r_1, r_2, \dots, r_n \} \subset \mathbb{Z}^+ $ be the set of resistor values. - Let $ \mathcal{S} = \{ S_1, S_2, \dots, S_n \} $ be the family of selections, where each $ S_i \subseteq R $ and $ |S_i| = i $. **Constraints** 1. $ 1 \le T \le 100 $ 2. $ 1 \le n \le 10^{100} $ 3. $ r_i \in \mathbb{Z}^+ $ for all $ i \in \{1, \dots, n\} $ **Objective** For each test case, find the selection $ S \in \mathcal{S} $ that minimizes the equivalent resistance of resistors in parallel: $$ R_{\text{eq}}(S) = \left( \sum_{r \in S} \frac{1}{r} \right)^{-1} $$ Output the minimal $ R_{\text{eq}}(S) $ as a reduced fraction $ \frac{p}{q} $, where $ \gcd(p, q) = 1 $ and $ p, q \in \mathbb{Z}^+ $.
API Response (JSON)
{
  "problem": {
    "name": "E. Resistors in Parallel",
    "description": {
      "content": "In this physics problem, what we are concerned about are only resistors. If you are poor at physics, do not worry, since solving this problem does not require you to have advanced abilities in physics",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 1048576
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10202E"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "In this physics problem, what we are concerned about are only resistors. If you are poor at physics, do not worry, since solving this problem does not require you to have advanced abilities in physics...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ T \\in \\mathbb{Z}^+ $ be the number of test cases.  \nFor each test case:  \n- Let $ n \\in \\mathbb{Z}^+ $ be the number of resistors.  \n- Let $ R = \\{ r_1, r_2, \\dots, r_n \\} \\sub...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments