DCP-473: Next Perfect Square Number Back to All Problems

Medium Search Techniques > Binary Search/Bisection


**Bunty** loves to play with numbers. This time he invents a game called "**finding next perfect square number**". In this game, Bunty will give you a positive integer **n** . You have to tell him the immediate next number which is a perfect square number. <br> Here **Perfect Square** is a number (**N**) such that there exists an integer number (**X**) such that **X*X=N**. Input: ------ Input starts with an integer **T (1<=T<=100000)** , denoting the number of test cases . Each of the next lines contains one integer **n**. **( 0 <= n <= 10^18)** . Output: ------- For every test case output the smallest number which is greater than **n** and is a perfect square number. Sample Input ------------ 3 1 2 4 Sample Output ------------- 4 4 9


Problem Setter:

Kazi Sohan

Please login to submit solution to this problem.

Problem Limits

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

Problem Stats

223/467

Solve/Submission

Ranking

# User Language Timing
01 FariD Cpp14 0.02s
02 ss1230 Cpp 0.03s
03 istiaqueshubho C 0.03s
04 Naim1611052 Cpp 0.03s
05 emrul Cpp 0.03s
06 milon019 C 0.03s
07 hasib9876 C 0.03s
08 bindu_britto Cpp 0.03s
09 mainulislam588 Cpp 0.03s
10 Sakhawat_CoU Cpp 0.03s
11 Frdhsn Cpp 0.03s
12 joymollick Cpp14 0.03s
13 tariqiitju Cpp 0.03s
14 Ruhul1975 Cpp 0.03s
15 prodipdatta7 Cpp 0.03s
16 shamimjucse Cpp 0.03s
17 Jisancse Cpp14 0.03s
18 shishir09 Cpp14 0.03s
19 kamrulashraf Cpp 0.03s
20 robin_aust Cpp 0.03s
21 pulak_ict_mbstu Cpp 0.03s
22 inzamamdu Cpp 0.03s
23 t0whid Cpp 0.03s
24 Zihad C 0.03s
25 rafid211 Cpp 0.03s
26 mir003 Cpp 0.03s
27 the_badcoder Cpp 0.03s
28 porag_ict Cpp 0.03s
29 Shamim_A Cpp 0.03s
30 muradhossen Cpp 0.03s
31 Rasel_cse Cpp 0.03s
32 arif26 Cpp 0.03s
33 asma_chy Cpp14 0.03s
34 hadiurju C 0.03s
35 afzalul C 0.03s
36 bu_hridoy Cpp 0.03s
37 SAIF_IIT8_JU C 0.03s
38 Mimsad Cpp 0.03s
39 0o_o0 Cpp 0.03s
40 Mushfiqur_Rahman C 0.04s
41 Nayem_Ahmed C 0.04s
42 Md_Mohiuddin C 0.04s
43 nazmulpcc Cpp 0.04s
44 Puja1409 Cpp14 0.04s
45 Dhrubo020 Cpp 0.04s
46 Fahim_41 C 0.04s
47 Durbin Cpp14 0.04s
48 kakarotto Cpp 0.04s
49 desh_chowdhury C 0.04s
50 mh755628 Cpp 0.04s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support