Editorial for Bể nước (OLP MT&TN 2022 CT)
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Hướng dẫn
Chúng ta có thể giải bài toán này bằng cách lập phương trình như sau:
Giả sử thể tích nước khi đầy bể \(1\), thì :
- trong 1 giờ vòi thứ nhất chảy được \(\frac{1}{a}\) bể.
- trong 1 giờ vòi thứ hai chảy được \(\frac{1}{b}\) bể.
Vậy trong 1 giờ, cả hai vòi chảy được \(\frac{1}{a} + \frac{1}{b}\) bể.
Theo công thức: lượng nước chảy được = năng suất * thời gian \(\Longrightarrow\) thời gian chảy đầy bể là \(\frac{1}{\frac{1}{a} + \frac{1}{b}}\).
Và đó chính là đáp án của đề bài. Lưu ý cần lấy \(5\) chữ số sau dấu thập phân
C++
cout << fixed << setprecision(5) << res << '\n'
Code tham khảo
C++
double t1 = a + b;
double t2 = a*b;
double res = t2/t1;
cout << fixed << setprecision(5) << res;
Comments