Subsequence Divisibility

Pages: 123
Hi, can anyone explain me what to do in this question.
Here's the link.

https://www.codechef.com/JULY18B/problems/MGCSET
only focus on those numbers of the sequence which are divisible by m
@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
Last edited on
@ipg 2016069
OUTPT
N=2
1 10

N=3
1 10

N=5
1 100

N=10
1 100000
@kashish
can you explain the Magic Set question a little bit more.
@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
Last edited on
closed account (iT0i3TCk)
the PINs which doesn't raise any alert are palindromes! Hope that you now get the point!
@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.
Can anyone give me the hint how to approach the "Magic Set" 2nd question of Codechef.

link is -:
https://www.codechef.com/JULY18B/problems/MGCSET
@zyan1zyan
focus only on the number which are divisible by m.
what is the answer for this input-
n = 5, k=3
2 3 3 3 7
Last edited on
..
Last edited on
Can anyone explain about what P and Q are in strike or spare
#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
@shikkari

Maximum value of N can be 105
maximum value of
pow(10,n-x-1) will be to large to store in any data type.That's why its giving error.
I understand that:)
Any help would be appreciated:)
How to calculate large exponential powers of 10
Last edited on
@Wasp
i have already explain about P and Q in earlier comments.
@ipg 2016069
you forget about zeros
When N=2
Then min=00
And max=99
any help for subtask 3 in reverse pin:)
@shikkari
You are not using vthis value for any calculation,you only have to print the value of pow(10,n-x-1),.This is the enough hint i guess.
Pages: 123