Skip to content

Commit 252e7ec

Browse files
committed
Added 1840B - Binary Cafe.cpp
1 parent f0b6edc commit 252e7ec

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

1840B - Binary Cafe.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// ॐ नमः शिवाय
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
#define ll long long
5+
6+
// Code Written By: Vikash Patel
7+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
8+
9+
int solve(int n, int k)
10+
{
11+
if(log2(n) < k)
12+
return n+1;
13+
return (int)pow(2, k);
14+
}
15+
int main()
16+
{
17+
int t;
18+
cin>>t;
19+
while(t--)
20+
{
21+
int n, k;
22+
cin>>n>>k;
23+
cout<<solve(n, k)<<endl;
24+
}
25+
return 0;
26+
}

0 commit comments

Comments
 (0)