fork download
  1. #include <fstream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <iomanip>
  5. using namespace std;
  6. int main() {
  7.  
  8. ifstream inp;
  9. ofstream otp;
  10. inp.open("input.txt");
  11. otp.open("output.txt");
  12.  
  13. double ans = 0, p = 0;
  14.  
  15. vector<int> g(4);
  16.  
  17. inp >> g[0] >> g[1] >> g[2] >> g[3] >> p;
  18.  
  19. sort(g.begin(), g.end());
  20.  
  21. ans = (g[0] + g[1]) * (1 - (p / 100));
  22.  
  23. ans = (ans + g[2]) * (1 - (p / 100));
  24.  
  25. ans = (ans + g[3]) * (1 - (p / 100));
  26.  
  27. otp << fixed << setprecision(2) << ans;
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty