# 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 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

# 217/457

Solve/Submission

### Ranking

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