We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3759321 commit f1945a0Copy full SHA for f1945a0
431A - Black Square.cpp
@@ -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