DCP-373: EDistance Back to All Problems

Beginner Beginners Problems > Ad-hoc

Have you heard the name of two Legendary Mathematician **Pythagoras** and **Euclid** ? They were great Greek Mathematicians.They are so famous that Microsoft corporation has added their name on the dictionary in MS word ! Nowadays every person we can’t deny with their contribution on Mathematics. Any way, I want to give an example about their contributory. You are very known about the famous Pythagorean theorem as :<br> > [otivuj<sup>2</sup> = lombo<sup>2</sup> + vumi<sup>2</sup> ]. <br> Yes, this Pythagorean (or Pythagoras') theorem is the statement that the sum of (the areas of) the two small squares equals (the area of) the big one. In algebraic terms, **a² + b² = c²**, where c is the hypotenuse (otivuj) while a and b are the legs of the triangle. The statement of the Theorem was discovered on a Babylonian tablet circa 1900-1600 B.C. The theorem is of fundamental importance in Euclidean Geometry where it serves as a basis for the definition of distance between two points. Then Euclid used this theorem to find the distance between two points which is known as Euclidean distance between two points. ![enter image description here][1] That’s all from Mahin has given a lecture to his two sister’s Hiya and Riya. Now he wants to assign a task to them, if they fail then he will give them a great punish. But Hiya and Riya both are very poor at mathematics. Can you help them? It is confirmed that you will get a treat from them. **The task is: <br/>** You have given **N**, which is an integer number representing the result of **euclidean distance** between any two **distinct** points. You have to tell weather **N** is the valid result or not which is generated by using euclidean distance formula.<br> If p(1,2) and q(3,4) are two points then they are two distinct points, where p(1,2) and q(1,2) are not. Input: ------ Input starts with an integer **T (1<= T <=130)**, denoting the number of test cases.<br> Each case contains an integer **N (-10<sup>50</sup> ≤ N ≤10<sup>50</sup>)** which described above.<br> ( Note: Integer can be very big and it may not fit in 64-bit integer range !! ) Output: ------- If **N** is the valid result for Euclidian distance between two distinct points then print **N is a valid result** print **N is not a valid result** otherwise, where **N** is given input. Print the **case** numbering at first. Sample Input ------------ 2 29 -87 Sample Output ------------- Case 1: 29 is a valid result Case 2: -87 is not a valid result [1]: https://s3-ap-southeast-1.amazonaws.com/devskillimagestorage/questionimages/36c47018-7218-c065-e237-08d4b89c15d2_ca8f5f9e9a04476096b78ff3b31949d0_W530xH424.png

Problem Setter:

Pranta Sarker

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 shahed95 Cpp 0.00s
02 _dipu Cpp 0.00s
03 pulak_ict_mbstu Cpp14 0.00s
04 mahade31 Cpp14 0.00s
05 Turin Cpp 0.00s
06 snow_man Cpp14 0.00s
07 mamun02inf Cpp14 0.00s
08 hrOarr Cpp 0.00s
09 Fuad_Islam Cpp 0.00s
10 emrul Cpp14 0.00s
11 anik_JU Cpp 0.00s
12 ikaadil Cpp 0.00s
13 Nobel Cpp 0.00s
14 Bruteforcekid Cpp14 0.00s
15 AmdSadi Cpp 0.00s
16 CLown1331 Cpp14 0.00s
17 Salam_35s Cpp 0.00s
18 neel71 Cpp14 0.00s
19 Bisnu039 Cpp 0.00s
20 Nahid_1710039 Cpp 0.00s
21 mansura Cpp 0.00s
22 kabbya Cpp 0.00s
23 akram Cpp 0.00s
24 rafi_1703076 Cpp14 0.00s
25 foysalislam Cpp14 0.00s
26 Ataur Cpp 0.00s
27 fncse Cpp 0.00s
28 solayman Cpp 0.00s
29 Thug_Life11 Cpp 0.00s
30 Najat Cpp 0.00s
31 shamimice03 Cpp14 0.00s
32 shamimjucse Cpp 0.00s
33 Big_Pappa Cpp 0.00s
34 iammarajul Cpp 0.00s
35 Taran Cpp14 0.00s
36 rakib_cou Cpp 0.00s
37 afridi13 Cpp 0.00s
38 Dalgerok Cpp 0.00s
39 Asif_Watson Cpp 0.00s
40 HurayraIIT Cpp14 0.00s
41 fayedanik Cpp 0.00s
42 SAIF_IIT8_JU Cpp 0.00s
43 aaman007 Cpp 0.00s
44 H_alexa Cpp 0.00s
45 mobasshir Cpp 0.00s
46 Robin008 Cpp 0.00s
47 Sakhawat_CoU Cpp 0.00s
48 AlaminJust Cpp 0.00s
49 Masum_ice Cpp 0.00s
50 Jisancse Cpp 0.00s

Your feedback is our precious!

Or call +88 02 9853138 for support