Click
Here to go back to the homepage.
Careful Ascent Solution:
#include <bits/stdc++.h>
using namespace std;
int main(){
// #ifndef TESTING
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
int x, y, nShields;
double shieldSum = 0;
cin >> x >> y >> nShields;
while(nShields--){
double start, end, multiplier;
cin >> start >> end >> multiplier;
shieldSum += multiplier * (end - start);
y -= end - start;
}
cout << fixed << setprecision(7);
cout << x / (shieldSum + y) << endl;
return 0;
}