NGIRL - Namit In Trouble
Namit's girlfriend birthday is coming next week.He went to a gift shop and saw (N) gifts are arranged in a single row in such a way that the position at which the gift is placed is equal to its price.(Position starts from 1.)
Namit's girlfriend being a maths student like those numbers which have exactly 3 divisors, so Namit decide to buy only those gifts which are placed at a position which have only 3 divisors, but Namit's girlfriend likes gifts whose price are above a certain amount(K).
Now Namit wants to know total choices he have and how many gifts his girlfriend like for a given value of N.
Input starts with 1<=T<=1000 (number of test cases). Then T lines follows each containing two integer 1<=N<10^10 (number of gifts at gift shop) and 1<=K<=10^10.
You program should output two values indicating total number of choices and the number of gifts Namit's girlfriend like.
Output: 2 2
can someone explain me why to use sieve while the question asked you to find out the number of exactly 3 divisors?
You do not need binary search. Simple sieve gave me AC
I can't understand the problem statement.
just take constraint 10^5 i.e. (10^5)^2<=10^10.
thanks @avasthiayush k>n cost me 3 WA .
Must consider the condition when k>n :)
Sieve Of Eratosthenes + Binary Search -> AC
Runs in my pc but gives compilation error here.
Can someone explain the question by explaining this test case
AC in one go too :)