My issue
include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t–){
long long n,k,x;
cin>>n;// length of array
cin>>k;// index at which x is occur
cin>>x;// //value of x
long long ans=pow(2,k-1);
if(x>=ans)cout<<“YES”<<endl;
else {
cout<<“NO”<<endl;
}
}
}
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
long long n,k,x;
cin>>n;// length of array
cin>>k;// index at which x is occur
cin>>x;// //value of x
long long ans=pow(2,k-1);
if(x>=ans)cout<<"YES"<<endl;
else {
cout<<"NO"<<endl;
}
}
}
Problem Link: Superincreasing Practice Coding Problem - CodeChef