diff --git a/Contributors.md b/Contributors.md index 5cbd19b..136388b 100644 --- a/Contributors.md +++ b/Contributors.md @@ -1,3 +1,4 @@ Shag Mittal Ketan Goyal Ashwini Pal +Damik Dhar \ No newline at end of file diff --git a/kgrammar.cpp b/kgrammar.cpp new file mode 100644 index 0000000..da8130b --- /dev/null +++ b/kgrammar.cpp @@ -0,0 +1,19 @@ +#include +using namespace std; +int solve(int n,int k){ + if(n==1 and k==1){ + return 0; + } + int mid=(pow(2,n-1))/2; + if(k<=mid){ + return solve(n-1,k); + } + else{ + return !solve(n-1,k-mid); + } +} +int main() { + int n,k; + cin >> n >> k; + cout<