# 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 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

# 167/540

Solve/Submission

### Ranking

# User Language Timing
01 Morass Cpp14 0.00s
02 souravahmed C 0.06s
03 SakibAlamin Cpp14 0.06s
04 SugiuraAyano C 0.06s
05 vatsalsharma376 Cpp14 0.07s
06 feodorv Cpp14 0.07s
07 Nazmul_WUB Cpp14 0.07s
08 Masum_ice Cpp14 0.07s
09 tarikul_4152 Cpp 0.07s
10 twyu0721 C 0.07s
11 afzalul Cpp 0.07s
12 pulak_ict_mbstu Cpp 0.07s
13 The_Viper Cpp14 0.07s
14 jayed_al_hasan Cpp14 0.07s
15 sirpoka Cpp14 0.07s
16 JubayerSohel Cpp14 0.07s
17 ss1230 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 Ashiq CSharp 0.17s
25 ronok_cse Cpp14 0.19s
26 MAHRahat Cpp14 0.22s
27 Najat Cpp14 0.24s
28 nazmul_bzs Cpp14 0.25s
29 deder Cpp14 0.26s
30 10102020 Cpp 0.26s
31 wayne6172 Cpp 0.27s
32 7Mahfuz Cpp14 0.27s
33 tariqiitju Cpp 0.28s
34 mamun02inf Cpp 0.28s
35 prateepm Cpp14 0.29s
36 FahimSifnatul Cpp14 0.30s
37 kakarotto Cpp14 0.30s
38 sakib_ruet_13 Cpp14 0.30s
39 Aint_Stain Cpp14 0.31s
40 ryan C 0.32s
41 jubel Cpp 0.33s
42 joymollick Cpp 0.33s
44 return_SS Cpp14 0.33s
45 Dinar Cpp14 0.34s
46 belal_mbstu Cpp14 0.34s
47 emrul Cpp14 0.36s
48 mazedulcs CSharp 0.37s
49 rabbicse CSharp 0.37s
50 Shubhode CSharp 0.38s
Feedback