Skip to content

Commit fadf1a5

Browse files
committed
Added 658A - Bear and Reverse Radewoosh.cpp
1 parent 70dcfb6 commit fadf1a5

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

658A - Bear and Reverse Radewoosh.cpp

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
// Code Written By: Vikash Patel
5+
6+
int main()
7+
{
8+
int n,c;
9+
cin>>n>>c;
10+
int p[n];
11+
int t[n];
12+
for(int i=0;i<n;i++)
13+
{
14+
cin>>p[i];
15+
}
16+
for(int i=0;i<n;i++)
17+
{
18+
cin>>t[i];
19+
}
20+
int Lp=0, Rp=0,lt=0,rt=0;
21+
for(int i=0;i<n;i++)
22+
{
23+
lt+=t[i];
24+
rt+=t[n-1-i];
25+
Lp+=max(0,p[i]-(c*lt));
26+
Rp+=max(0,p[n-1-i]-(c*rt));
27+
}
28+
if(Lp>Rp)
29+
cout<<"Limak"<<endl;
30+
else if(Lp<Rp)
31+
cout<<"Radewoosh"<<endl;
32+
else
33+
cout<<"Tie"<<endl;
34+
}

0 commit comments

Comments
 (0)