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

140/484

Solve/Submission

Ranking

# User Language Timing
01 mobasshir Cpp 0.00s
02 asiuzzaman006 Cpp 0.00s
03 duronto20 Cpp 0.00s
04 shahadat191 Cpp 0.00s
05 Jisancse Cpp 0.00s
06 emrul Cpp14 0.00s
07 Najat Cpp 0.00s
08 shamimjucse Cpp 0.00s
09 Masum_ice Cpp 0.00s
10 CLown1331 Cpp14 0.00s
11 liar Cpp 0.00s
12 Santho07 Cpp 0.00s
13 akram Cpp 0.00s
14 wizard Cpp 0.00s
15 Logic_Hunter Cpp14 0.00s
16 pulak_ict_mbstu Cpp14 0.00s
17 mohibur Cpp 0.00s
18 abufarhad Cpp14 0.00s
19 fayedanik Cpp 0.00s
20 Taran Cpp14 0.00s
21 Ramprosad Cpp 0.00s
22 feodorv C 0.00s
23 anik_JU Cpp 0.00s
24 snow_man Cpp14 0.00s
25 AlaminJust Cpp 0.00s
26 neel71 Cpp14 0.00s
27 foysalislam Cpp14 0.00s
28 fncse Cpp 0.00s
29 shamimice03 Cpp14 0.00s
30 Md_Mazbah Cpp 0.00s
31 Sakhawat_CoU Cpp 0.00s
32 Ishraq_Nibir Cpp 0.00s
33 hrOarr Cpp 0.00s
34 shahed95 Cpp 0.00s
35 Abu_Sakib Cpp 0.00s
36 DynamicOvi Cpp 0.00s
37 aaman007 Cpp 0.00s
38 kabbya Cpp 0.00s
39 Ataur Cpp 0.00s
40 rakib_cou Cpp 0.00s
41 mamun02inf Cpp14 0.00s
42 ashikur_rahman Cpp 0.00s
43 _dipu Cpp 0.00s
44 iammarajul Cpp 0.00s
45 Bisnu039 Cpp 0.00s
46 rabbycse Cpp14 0.00s
47 Bruteforcekid Cpp14 0.00s
48 Frdhsn Cpp 0.00s
49 rakibulhasanmrh Cpp 0.00s
50 mahade31 Cpp14 0.00s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support