@wasp and @kashish can you give me output for test case: N=2,N=3, N=5 and N=10 for question Strike or spare. Question is here https://www.codechef.com/JULY18B/problems/PINS
@kashish can you please explain
If N=2 then there are length 2 decimal numbers. For example like 11 or 12 then the probability of getting revers number is 1or 0.5 so total probability is 0.5(1/2) then answer should be for N=2
is 1 2
Why answer is 1 10 . Can you explain?
If N=3 then take the example like 123 or 112 or 111 then probability of getting revers number is 1/3!(1/6) or 1/3 or 1 so total probability is 1/18 so answer should be for N =3 is 1 18
@ipg 2016069
In the question
P is the number combination of N digit whose reverse is same as the number.
And Q is the total number of combination of N digit that can be formed.
#include <iostream>
#include<string>
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long t;
cin>>t;
for(int i=0;i<t;i++){
long long n;
long long p,q;
cin>>n;//length of ppin
long long x=n/2;
if(n%2==0){
p=1;
q=pow(10,n-x);
}
if(n%2!=0){
p=1;
q=pow(10,(n-x-1));
}
cout<<p<<" "<<q<<endl;
}
}
This code is giving error in subtask 3 hen is order 10^5 can someone help in subtask 3