My issue
Can someone Please help me with this Question
My code
#include <iostream>
using namespace std;
int main() {
// your code goes here
return 0;
}
Problem Link: ABCXOR Problem - CodeChef
Can someone Please help me with this Question
#include <iostream>
using namespace std;
int main() {
// your code goes here
return 0;
}
Problem Link: ABCXOR Problem - CodeChef
@checking123
Plzz refer my solution
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--)
{
long long int n,k;
cin>>n>>k;
long long int p=1;
while(n--)
{
p=p*2;
}
long long int ans=(p-1)*(p-2);
cout<<ans<<endl;
}
return 0;
}
I just want to Know the detailed approach how you think that and what is the logic behind this
Please can you explain that.
Its totally maths
first how many choices u have is :-
let m=2^n;
the choices we have is mc3*3!
3! is to rearrange a,b,c.
but this includes repetition.
so we divide it my m.
which will gives us the formula (mc3*3!)/m;
and by some smaller cases observation u will find that this formula is independent of k.
. So solve this formula u will get the actual formula which is (m-1)*(m-2).
Its quite less intuitive but yeah easy to get it from observation .