DCP-442: Want a Bride in This Winter Back to All Problems

Easy Math > Basic Math


So the winter is finally here. Last night I was scrolling Pacebook and I notice a very serious event named **Ei Shit e Bou Chai**. To show my solidarity I pressed the **Going** option. My father somehow noticed and commented on my response to that event. The response was like that, "If you are able to solve the following problem I will let you marry." > You need to tell me whether it is possible to have exactly K numbers between 1 > to N such that A<sup>2</sup> + A<sup>3</sup> will be a square number where 1<= A <= N. I tried whole night to figure out any clue about the problem but failed. That’s why I am now here to have your help. Could you help me finding it? Input: ------ Input starts with an integer **T** which is the test case. For each of the T lines, you will have two integers **N** and **K**. Constraints: --------------- 1<= **T** <= 10000<br> 1<= **N, K** <= 10^5 Output: ------- For each test case, you have to print **"I am married now"** without any quote if there are a total of **K** such **A** less than or equal to **N** such that each A’s summation of square and cube (i.e. **A<sup>2</sup> + A<sup>3</sup> where A<=N**) will be a square number. Otherwise, print **"Baba amar ki biye hobe na"** without any quote. Sample Input ------------ 2 3 1 3 2 Sample Output ------------- I am married now Baba amar ki biye hobe na Explanation ---------------- In the first test case, - Let, A = 1. So, A<sup>2</sup> + A<sup>3</sup> = 2 . 2 is not a square number. - Let, A = 2. So, A<sup>2</sup> + A<sup>3</sup> = 4 + 8 = 12. 12 is not a square number. - Let, A = 3. So, A<sup>2</sup> + A<sup>3</sup> = 9 + 27 = 36. 36 is a square number. Hence we have 1 square number for A = 3 which is equal to K = 1. But in the 2nd test case, we have K = 2.So it’s not possible to have K = 2.


Problem Setter:

Avik Sarkar

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 1.00
C++ 1.00
C++14 1.00
C# 2.00
Go 2.00
Java 2.00
JavaScript 2.00
Objective-C 2.00
Perl 2.00
PHP 2.00
Python 2.00
Python3 2.00
Ruby 2.00
VB.Net 2.00

Problem Stats

147/508

Solve/Submission

Ranking

# User Language Timing
01 jalal Cpp 0.00s
02 BishalG C 0.00s
03 astinaam Cpp14 0.00s
04 emrul Cpp 0.00s
05 SaikatS Cpp 0.00s
06 the_badcoder Cpp 0.00s
07 FariD Cpp 0.00s
08 fire_tornado Cpp 0.00s
09 Rajan_sust Cpp 0.00s
10 Silent_Warrior Cpp 0.01s
11 Sakhawat_CoU Cpp14 0.01s
12 SakibAlamin Cpp14 0.01s
13 kissu_pari_na Cpp14 0.01s
14 susmoys Cpp 0.01s
15 Not_Found0001 Cpp 0.01s
16 porag_ict Cpp14 0.01s
17 AlaminJust Cpp 0.01s
18 Chayti_Saha98 Cpp14 0.01s
19 _GhOstMan_ Cpp 0.01s
20 Ramprosad Cpp 0.01s
21 feodorv Cpp 0.01s
22 kzvd4729 Cpp 0.01s
23 tlcakash Cpp 0.01s
24 Ehsanul_Fahad Cpp 0.01s
25 Riaz_BSMRSTU Cpp 0.01s
26 shuvo_mbstu Cpp 0.01s
27 acwatlerte Cpp 0.01s
28 souravahmed C 0.01s
29 atiqurrahman Cpp 0.01s
30 Sarwar05 Cpp 0.01s
31 sifat_15 Cpp 0.01s
32 Reayz Cpp 0.01s
33 saifkhan007420 Cpp 0.01s
34 shishir09 Cpp14 0.01s
35 The_Viper Cpp 0.01s
36 rayhan50001 Cpp 0.01s
37 tariqiitju Cpp 0.01s
38 saiful130104 Cpp 0.01s
39 Ishrak Cpp 0.01s
40 MRITuhin Cpp 0.01s
41 Durbin Cpp14 0.01s
42 mbstu_nitai Cpp 0.01s
43 haasib Cpp 0.01s
44 ehsan_sshuvo Cpp 0.01s
45 showmic Cpp 0.01s
46 Mr_adnan Cpp 0.01s
47 orpib Cpp 0.01s
48 rohijulislam Cpp 0.01s
49 Pure_Protea Cpp14 0.01s
50 duronto20 Cpp 0.01s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support