#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define pf push_front
#define ep emplace_back
#define ef emplace_front
#define len(a) *(&a+1)-a
#define int long long
#define ld long double
#define mod 1000000007
#define stoi stoll
#define all(ls) ls.begin(),ls.end()
#define allr(ls) ls.rbegin(),ls.rend()
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2")
using namespace std;
using namespace __gnu_pbds;
template<typename type>using ordered_set=tree<type,null_type,less<type>,rb_tree_tag,tree_order_statistics_node_update>;
template<typename type>using ordered_multiset=tree<type,null_type,less_equal<type>,rb_tree_tag,tree_order_statistics_node_update>;
struct custom_hash{
static uint64_t splitmix64(uint64_t x){
x+=0x9e3779b97f4a7c15;
x=(x^(x>>30))*0xbf58476d1ce4e5b9;
x=(x^(x>>27))*0x94d049bb133111eb;
return x^(x>>31);
}
size_t operator()(uint64_t x) const{
static const uint64_t FIXED_RAnDOM=chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x+FIXED_RAnDOM);
}
};
int integer(int n){
int num=n;
int dec_value=0;
int base=1;
int temp=num;
while(temp>0){
int last_digit=temp%10;
temp/=10;
dec_value+=last_digit*base;
base*=2;
}
return dec_value;
}
void solve(){
int n,k,a,b;
cin>>n>>k,a,b;
string s;
cin>>s;
cin>>a;
cin>>b;
int ans=0;
for(int i=0;i<n-1;i++){
if(s[i]=='L')
ans+=integer(a);
else
ans+=integer(b);
}
cout<<ans<<endl;
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
cout.tie(nullptr);
// freopen("talent.in","r",stdin);
// freopen("talent.out","w",stdout);
int t=1;
// cin>>t;
while(t--){
solve();
}
}
Compilation message
ljetopica.cpp: In function 'void solve()':
ljetopica.cpp:54:14: warning: right operand of comma operator has no effect [-Wunused-value]
54 | cin>>n>>k,a,b;
| ^
ljetopica.cpp:54:15: warning: right operand of comma operator has no effect [-Wunused-value]
54 | cin>>n>>k,a,b;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |