DCP-529: Square and Cube Back to All Problems

Easy Math > Basic Math


You are given an integer <b>N</b>, determine whether it is a perfect square or a perfect cube or both (it is a perfect square and also a perfect cube) or none (it is not a perfect square and also not a perfect cube). We know, a perfect square is a number that can be expressed as the **product of two equal integers**. Also, a perfect cube is a number that can be expressed as the **product of three equal integers**. Input: ------ Input starts with an integer **T (1 ≤ T ≤ 10<sup>3</sup>)**, denoting the number of test cases. Each case contains an integer **N (1 ≤ N ≤ 10<sup>9</sup>)**. Output: ------- For each case of input: - Print <b>Perfect Square</b> if <b>N</b> is a perfect square. - Print <b>Perfect Cube</b> if <b>N</b> is a perfect cube. - Print <b>Both</b> if <b>N</b> is a perfect square and also a perfect cube. - Print <b>None</b> if <b>N</b> is not a perfect square and also not a perfect cube. Sample Input ------------ 2 1 4 Sample Output ------------- Both Perfect Square


Problem Setter:

Emrul Chowdhury

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

189/613

Solve/Submission

Ranking

# User Language Timing
01 robin_aust Cpp 0.00s
02 kamran_11b Cpp 0.00s
03 Bruteforcekid Cpp14 0.00s
04 Ayon_neub Cpp 0.00s
05 shekhar_kuet Cpp 0.00s
06 Zeronfinity Cpp 0.00s
07 morol Cpp14 0.00s
08 astrolion7 Cpp 0.00s
09 IIUC_minhazmiraz Cpp14 0.00s
10 Dragon_Curve Cpp 0.00s
11 t0whid Cpp 0.00s
12 _GhOstMan_ Cpp 0.00s
13 shoumo Cpp14 0.00s
14 Bisnu039 Cpp 0.00s
15 orpib Cpp 0.00s
16 Fahim_41 Cpp 0.00s
17 mh755628 Cpp 0.00s
18 kashem1993 Cpp 0.00s
19 7Mahfuz Cpp 0.00s
20 SAIF_IIT8_JU Cpp 0.00s
21 DynamicOvi Cpp 0.00s
22 Riz1ahmed Cpp 0.00s
23 joymollick Cpp 0.00s
24 rakibislam1996 Cpp14 0.00s
25 darXtar C 0.00s
26 hassanmdsifat Cpp 0.00s
27 Maruf_Robin Cpp 0.00s
28 Rasel_cse Cpp 0.00s
29 Sadi9 Cpp 0.00s
30 Bappy Cpp 0.00s
31 Mushfiqur_Rahman C 0.00s
32 Chayti_Saha98 Cpp 0.00s
33 leenaiitju Cpp 0.00s
34 loser_123 Cpp 0.00s
35 wajiul Cpp 0.00s
36 Ishraq_Nibir Cpp 0.00s
37 jannat_4 C 0.00s
38 alamkhan Cpp 0.00s
39 the_badcoder Cpp 0.00s
40 mdrifat Cpp 0.00s
41 prottoy919 Cpp 0.00s
42 1604099_ishtiaq Cpp 0.00s
43 safuterc C 0.00s
44 acwatlerte Cpp 0.00s
45 5h4n70 Cpp 0.00s
46 Gulam_Kibria Cpp 0.00s
47 aaman007 Cpp 0.00s
48 ssavi Cpp 0.00s
49 Joyislam C 0.00s
50 joty_ict Cpp 0.00s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support