untitle

public
yousefkarem91 Sep 12, 2024 Never 57
Clone
C++ past.cpp 24 lines (23 loc) | 396 Bytes
1
#include <bits/stdc++.h>
2
using namespace std;
3
int main()
4
{
5
int a,b,c;
6
cin>>a>>b>>c;
7
int k;
8
cin>>k;
9
int add=pow(2,k);
10
if(a>=b && a>=c) {
11
//a is the largest
12
cout<<a*add+b+c;
13
}
14
else if(b>=c)
15
{
16
//b is the largest
17
cout<<a+b*add+c;
18
}
19
else {
20
//c is the largest
21
cout<<a+b+c*add;
22
}
23
24
}