DCP-31: Divide and Fool Back to All Problems

Easy Beginners Problems > Ad-hoc


Arif is just a 1st year computer science student. His elder brother Hasan on the other hand is a 4th year computer science student and a very good programmer. But Hasan is a bit naughty and he likes to make fun of his younger brother by giving him task to fool him. This time Hasan told his brother Arif to write a program that takes 2 integers as input and prints the division result but the only condition is he has to print up to a certain digit with accuracy. Arif being a new programmer feels this is an easy task and writes the code. But unfortunately his program does not print the result accurately enough after the decimal point and fails for the following input: **X = 22, Y = 7, P = 25** Here X is the 1st number, Y is the 2nd number and P is the total digits after the decimal place that he needs to print for the division result. Arif’s program prints the result as: **3.14285714285714** but the correct result should be: **3.1428571428571428571428571**. Arif feels sad as he has failed the challenge again, but this time he asks for your help to complete the task. Please help poor Arif in this problem. Input: ------ First line of the input will consist of an integer which represent the test case **T (0<T<=30)**. Each test case contains 3 integers X, Y, P. You can assume **(0 > X, Y, P <=100)**, that is X, Y and P all will be greater than zero and less than or equal to 100. Your task is to divide X with Y until you print P digits after the decimal point of the result. Output: ------- For each test case print the division result as mentioned above in its own line. Sample Input ------------ 3 22 7 25 4 2 10 1 12 7 Sample Output ------------- 3.1428571428571428571428571 2.0000000000 0.0833333


Problem Setter:

MD. Jalal Uddin

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

80/153

Solve/Submission

Ranking

# User Language Timing
01 MAHRahat Cpp14 0.00s
02 murad_al_wajed Cpp14 0.00s
03 Rijoanul_Shanto Cpp 0.00s
04 haasib Cpp14 0.00s
05 emrul Cpp14 0.00s
06 Masum_ice Cpp14 0.00s
07 maxhasan Cpp 0.00s
08 lazyfahim Cpp 0.00s
09 deder Cpp14 0.00s
10 rayhan50001 Cpp14 0.00s
11 Logic_Hunter Cpp14 0.00s
12 abufarhad Cpp14 0.00s
13 mrinmoi Cpp 0.00s
14 feodorv C 0.00s
15 anik_JU Cpp14 0.00s
16 seyedssz Cpp14 0.00s
17 terminator_c Cpp14 0.00s
18 Kira Cpp 0.00s
19 sadia2427 Cpp14 0.00s
20 SakibAlamin Cpp14 0.00s
21 tico88612 Cpp14 0.00s
22 Ratul728 Cpp14 0.00s
23 rithu Cpp14 0.00s
24 abdulmukit Cpp 0.00s
25 joymollick Cpp 0.00s
26 Morass Cpp14 0.00s
27 souravahmed C 0.00s
28 Robbinb1993 Cpp 0.00s
29 Roz_94 Cpp 0.00s
30 Vega_CSE Cpp 0.00s
31 rabbicse Cpp 0.00s
32 joy25896 Cpp14 0.01s
33 mahmud2690 Cpp14 0.01s
34 nazmul_bzs Cpp14 0.01s
35 monir769 Cpp 0.01s
36 giash_uddin Cpp14 0.01s
37 AbirRahman Cpp14 0.01s
38 gazi93 Cpp 0.01s
39 7Mahfuz Cpp14 0.01s
40 subhashis_cse Cpp14 0.01s
41 ash12 Cpp14 0.01s
42 rockersabbir CSharp 0.02s
43 Ashiq CSharp 0.02s
44 rafsanulhasan CSharp 0.02s
45 saeefad CSharp 0.02s
46 devcoder CSharp 0.02s
47 nazmulhyder CSharp 0.02s
48 hasanuzzaman333 CSharp 0.02s
49 RandyWaterhouse Python3 0.03s
50 tariqiitju Python3 0.04s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support