Skip to content

Commit 33c7f46

Browse files
committed
Sept Long : Travel Pass
1 parent f3fba53 commit 33c7f46

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Travel-Pass.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Codechef Septempter Long Challenge DIV 3
2+
// Travel Pass
3+
#include<iostream>
4+
using namespace std;
5+
6+
int main()
7+
{
8+
int num_of_test_cases ;
9+
cin>>num_of_test_cases;
10+
int arr[3];
11+
for (int i = 0; i < num_of_test_cases; i++)
12+
{
13+
for (int j = 0; j < 3; j++)
14+
{
15+
cin>>arr[j];
16+
}
17+
char st[arr[0]];
18+
for (int k = 0 ; k < arr[0] ; k++)
19+
{
20+
cin>>st[k];
21+
}
22+
int inter_district = 0 ;
23+
int inter_state = 0 ;
24+
for (int l = 0; l < arr[0]; l++)
25+
{
26+
st[l] == '0' ? inter_district++:inter_state++;
27+
}
28+
cout<<inter_state*arr[2] + inter_district*arr[1] <<endl;
29+
}
30+
31+
return 0 ;
32+
}

0 commit comments

Comments
 (0)