ICPC Quốc gia 2016-2017 - Bài I: Go home
Đề bài
I. Go home
Standard I/O | Time Limit: 1s | Memory Limit: 256 MB
(Python on oj.vietnamson.com: 3s)
Row, row, row a boat, gently down the stream.
Merrily, merrily, merrily, merrily, life is but a dream.
Every day, Hieu must go to school. Hieu's house is at point $A$ with coordinates $(x_A, y_A)$. Hieu's school is at point $B$ with coordinates $(x_B, y_B)$. There is a river flowing in a straight line, from $(-10^9, 0)$ to $(10^9, 0)$. In the river, water flows with speed $v_S$. Hieu can walk in land with speed $v_W$ or row a boat in the river with speed $v_R$ (relative to the water). Your task is to calculate what is the minimum time for Hieu to go from home to school and from school to home?
Input
The input starts with the number of test – $T$ $(T \le 100)$. Then $T$ tests follow. Each test is printed in a single line contains 7 space-separated integers: $x_A, y_A, x_B, y_B, v_S, v_W, v_R$.
All numbers in input does not exceed $100$ by absolute value and $v_S, v_W, v_R \gt 0$.
Output
For each test, print one number: the total time for Hieu to go from home to school and from school to home, with exactly 2 digits after decimal place.
VIETNAMSON note: the river is the line $y = 0$ (no width); Hieu may walk anywhere, including across the river, and may row along the river: downstream (direction $+x$) with speed $v_R + v_S$, upstream with speed $v_R - v_S$ (only if $v_R \gt v_S$). The checker requires exactly 2 digits after the decimal point and accepts an absolute error of at most $0.01$ (rounding). The original statement does not give time/memory limits; the limits above are set by oj.vietnamson.com.
Input
1
0 2 8 -4 1 10 8
Output
2.00Ý tưởng và lời giải chi tiết
Phần phân tích ý tưởng, các cách giải từ cơ bản đến tối ưu kèm code C++/Python và chấm thử trên VIETNAMSON OJ dành cho học viên đã đăng ký gói.
- Không biết học gì trước, học gì sau, học lan man nên kiến thức bị hổng.
- Bí bài không ai gỡ, ngồi cả buổi vẫn không ra rồi bỏ cuộc.
- Code chạy được nhưng không đủ điểm, không biết sai ở đâu, chậm ở đâu.
- Không có đề thi thử và người chấm, nên không biết mình đang ở mức nào.
- Dễ nản giữa chừng khi không có ai theo sát.
- Lộ trình 111 buổi video sắp sẵn từ dòng code đầu tiên đến đề HSG thật của các tỉnh.
- Thầy trực tiếp gỡ bí, chữa bài cho từng em qua nhóm Zalo riêng.
- Hệ thống chấm bài tự động 24/7 và thi thử HSG hằng tuần để biết chính xác mình đang ở đâu.
- Đóng học phí một lần, thầy kèm lâu dài: từ thi chuyên Tin đến HSG quốc gia và cả khi lên đại học.
