Skip to content

Commit f1945a0

Browse files
committed
Added 431A - Black Square.cpp
1 parent 3759321 commit f1945a0

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

431A - Black Square.cpp

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
// Code Written By: Vikash Patel
5+
6+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
7+
8+
int main()
9+
{
10+
int a1,a2,a3,a4;
11+
cin>>a1>>a2>>a3>>a4;
12+
string s;
13+
cin>>s;
14+
int calories=0;
15+
for(auto i : s)
16+
{
17+
if(i=='1')
18+
calories+=a1;
19+
else if(i=='2')
20+
calories+=a2;
21+
else if(i=='3')
22+
calories+=a3;
23+
else
24+
calories+=a4;
25+
}
26+
cout<<calories<<endl;
27+
}

0 commit comments

Comments
 (0)