Comprando Produtos
Problem LinkSolution by TheRealFertos — 100 pts
Code / Notes
#include <bits/stdc++.h>
using namespace std;
int main() {
int k, l;
cin >> k >> l;
vector <int> bitcrush6(k);
for (auto &x: bitcrush6) {//levantei //&
cin >> x;//bruh
}//q negoco chato
int price=0;
for (int i=0; i<k; i++) {
if ((l & (1 << i))!=0) {
price+=bitcrush6[i];
}
}
cout << price << endl;
}
Last updated 1 month, 1 week ago