Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include <bits/stdc++.h>
using namespace std;
int m[5], w[5], x[] = {500, 1000, 1500, 2000, 2500}, h1, h2;
int main() {
for(int i = 0; i < 5; ++i)
cin >> m[i];
for(int i = 0; i < 5; ++i)
cin >> w[i];
cin >> h1 >> h2;
double res = 0;
for(int i = 0; i < 5; ++i)
res += max(0.3 * x[i], (1.0 - m[i]/250.0) * x[i] - 50.0 * w[i]);
res += h1 * 100;
res -= h2 * 50;
cout << res << endl;
return 0;
}
Copy The Code &
Try With Live Editor
Input
20 40 60 80 100
0 1 2 3 4
1 0
0 1 2 3 4
1 0
Output
4900
Demonstration
Codeforces Solution-Uncowed Forces-Solution in C, C++, Java, Python