Chef and Three Dogs
All submissions for this problem are available.
Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
Chef has three dogs sitting at the vertices of an equilateral triangle. The length of each side of the triangle equals to s meters. Chef gives the command "Start!" and each dog starts to run with constant speed v meters per second. At each moment, each dog is running towards the dog just right to him (in counter-clockwise direction). Therefore, their trajectories are forming some spirals that converging to one point as illustrated below.
How long does it takes dogs to meet each other after the command "Start!"?
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The only line of each test case contains two space-separated integers s and v.
For each test case, output a single line containing a real number corresponding to the answer of the problem. The answer will be considered correct if its absolute or relative error does not exceed 10-6.
- 1 ≤ T ≤ 10
- 1 ≤ s, v ≤ 109
- Subtask #1 (40 points): 1 ≤ s, v ≤ 10
- Subtask #2 (60 points): original constraints
Input: 2 2 5 1 1000000000 Output: 0.266667 0.0000001
Due to the triangle being very small, but the dogs running extremely fast, they will meet after less than 1e-6 seconds. Thus, due to remark about absolute or relative error in the output section, any answer within [0, 1e-6] will be considered correct.
|Tags||antoniuk1, oct16, simple, symmetry, trigonometry|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.