ABC096B - Maximum Sum
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main(void) { int a, b, c, k; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b >> c; cin >> k; cout << a + b + c + max(a, max(b, c)) * ((int)pow(2.0, k) - 1) << "\n"; return 0; }