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




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

Your feedback is our precious!

Or call +88 02 9853138 for support