You are given an array equations in the form [Ai, Bi] and an array values (Ai / Bi = values[i]). Given some queries [Ci, Di], return the answers. If the answer does not exist, return -1.0.
Example 1:
Input: 2 a b b c 2.0 3.0 3 a c b a a e Output: 6.0 0.5 -1.0
Constraints:
- 1 ≤ equations.length ≤ 20
- equations[i].length == 2
- 1 ≤ Ai.length, Bi.length ≤ 5
- values[i] > 0
- 1 ≤ queries.length ≤ 20
Input format: First line: number of equations. Second line: pairs "Ai Bi" per line. Third line: values. Then queries count, then one "Ci Di" per line.
Output format: Space-separated answers (6 decimal places).