My issue
include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin >> t;
while (t--) {
ll n, k, x, sum = 0;
cin >> n >> k >> x;
sum = (1 LL << (k - 1));
if (x >= sum)
cout << "YES" << "\n";
else
cout << "NO" << "\n";
}
return 0;
}
why is my code incorrect
My code
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin >> t;
while (t--) {
ll n, k, x, sum = 0;
cin >> n >> k >> x;
sum = (1 LL << (k - 1));
if (x >= sum)
cout << "YES" << "\n";
else
cout << "NO" << "\n";
}
return 0;
}
Problem Link: Superincreasing Practice Coding Problem - CodeChef