DCP-162: Love And Fight Back to All Problems

Easy Math > Number Theory

MAMUN is a programmer. He is intelligent but not smart. One day he went to university. He saw a girl and follows her. But he doesn’t know, she has a boyfriend and he is very dangerous. His name is NAHID. ![enter image description here][1] After sometimes, NAHID goes there quickly. Then NAHID begin to hit him. MAMUN becomes angry. Then MAMUN also start hitting NAHID. **• NAHID’s number of hit is A • MAMUN’s number of hit is B** You are a junior programmer. The given input is the product of their hit number N (A*B). In this problem, you have to find the minimum difference between number of hit of MAMUN and NAHID. Input: ------ The first line of the input file contains an integer T(1<=T<=100), denoting the number of test cases. Each of the following T lines contains a single integer N(1<=N<=10<sup>12</sup>). Output: ------- Output **T** lines of non-negative integer, each line contains minimum possible difference between A & B. Sample Input ------------ 2 20 4 Sample Output ------------- 1 0 [1]: https://s3-ap-southeast-1.amazonaws.com/devskillimagestorage/questionimages/e80a839b-1f81-c70f-3848-08d3ebbb9643_665c9a25f8df472cb95d26e5adca27db_W312xH140.png

Problem Setter:

Anowar Hossain Anu

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# 3.00
Go 3.00
Java 3.00
JavaScript 3.00
Objective-C 3.00
Perl 3.00
PHP 3.00
Python 3.00
Python3 3.00
Ruby 3.00
VB.Net 3.00

Problem Stats




# User Language Timing
01 Morass Cpp14 0.00s
02 SakibAlamin Cpp14 0.06s
03 souravahmed C 0.06s
04 SugiuraAyano C 0.06s
05 jayed_al_hasan Cpp14 0.07s
06 vatsalsharma376 Cpp14 0.07s
07 tarikul_4152 Cpp 0.07s
08 twyu0721 C 0.07s
09 feodorv Cpp14 0.07s
10 ss1230 Cpp14 0.07s
11 JubayerSohel Cpp14 0.07s
12 sirpoka Cpp14 0.07s
13 pulak_ict_mbstu Cpp 0.07s
14 afzalul Cpp 0.07s
15 Nazmul_WUB Cpp14 0.07s
16 Masum_ice Cpp14 0.07s
17 The_Viper Cpp14 0.07s
18 Alamgir_JUST Cpp14 0.08s
19 Ashish972 Cpp14 0.08s
20 devcoder CSharp 0.09s
21 Anubis Cpp14 0.15s
22 I_Monimul Cpp14 0.15s
23 shishir09 Cpp14 0.15s
24 ronok_cse Cpp14 0.19s
25 MAHRahat Cpp14 0.22s
26 Najat Cpp14 0.24s
27 nazmul_bzs Cpp14 0.25s
28 deder Cpp14 0.26s
29 10102020 Cpp 0.26s
30 wayne6172 Cpp 0.27s
31 7Mahfuz Cpp14 0.27s
32 tariqiitju Cpp 0.28s
33 mamun02inf Cpp 0.28s
34 prateepm Cpp14 0.29s
35 kakarotto Cpp14 0.30s
36 FahimSifnatul Cpp14 0.30s
37 sakib_ruet_13 Cpp14 0.30s
38 Aint_Stain Cpp14 0.31s
39 ryan C 0.32s
40 return_SS Cpp14 0.33s
41 Mahadi024 Cpp14 0.33s
42 joymollick Cpp 0.33s
43 jubel Cpp 0.33s
44 belal_mbstu Cpp14 0.34s
45 Dinar Cpp14 0.34s
46 emrul Cpp14 0.36s
47 rabbicse CSharp 0.37s
48 mahbub07 Cpp14 0.39s
49 monsurmp Cpp14 0.40s
50 NEUBAkash Cpp14 0.41s

Your feedback is our precious!

Or call +88 02 9853138 for support