Editorial for Tích số lớn nhất
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.
Author:
int main(int argc, wchar_t** argv, wchar_t** envp) {
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
if (fopen((FNAME + ".INP").c_str(), "r")) {
freopen((FNAME + ".INP").c_str(), "r", stdin);
freopen((FNAME + ".OUT").c_str(), "w", stdout);
}
ll a, b, c, s; cin >> a >> b >> c >> s;
lf sum = a + b + c;
cout << fixed << setprecision(6);
if (sum) {
cout << s * a / sum << ' ' << s * b / sum << ' ' << s * c / sum;
} else {
cout << 0.0 << ' ' << 0.0 << ' ' << 0.0;
}
return EXIT_SUCCESS;
}
Comments