DCP-263: Chocolates Division Back to All Problems

Medium Math > Basic Math


One day **Saiful** and **Sumon** decided to go an orphanage to give some chocolates to the orphans. But they are unable to figure out how to distribute chocolates. Suddenly they saw that their close friend **Badhan Sen** coming toward them. They told him everything and asked his help for this situation. Badhan said that they should follow following rules to give chocolates to the orphans: - Chocolate should be given equally to all orphans. - If some chocolates left: - Divide it equally between them ( **Saiful** and **Sumon** ) if possible. - If equal distribution is impossible, **Saiful** will have the bigger share of it. They Said "Okay,We will follow your rule". Now, Help them to strictly follow the rule. **Input:** ------------ The first line of the input will consist of an integer which represents the test case T (0 < T <= 1000). Each test case contains two integers **N (0 <= N <= 2^63 -1 ) and M (0 <= M <= 100000 )** Number of chocolates that Saiful and Sumon are going to divide among the M orphans. **Output:** --------------- For every test case, print the **Case #x: 'O' chocolates, 'Si' chocolates and 'SU' chocolates**. Here x is the test case number and three integers ‘O’, ‘SI’ and ‘SU’ denotes the number of chocolates each orphan, Saiful and Sumon have. See Sample Input and Output for clarifications. Note: While printing be careful about "chocolate" and "chocolates" if there are more than one chocolate, you should print "chocolates" otherwise chocolate. **Sample Input:** -------------------- 2 14 5 13 5 **Sample Output:** ------------------------ Case #1: 2 chocolates, 2 chocolates and 2 chocolates Case #2: 2 chocolates, 2 chocolates and 1 chocolate


Problem Setter:

Badhan Sen

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 0.50
C++ 0.50
C++14 0.50
C# 1.00
Go 1.00
Java 1.00
JavaScript 1.00
Objective-C 1.00
Perl 1.00
PHP 1.00
Python 1.00
Python3 1.00
Ruby 1.00
VB.Net 1.00

Problem Stats

42/178

Solve/Submission

Ranking

# User Language Timing
01 jahid_ict Cpp14 0.00s
02 nafiamahjabin Cpp14 0.00s
03 Pure_Protea Cpp14 0.00s
04 rayhan50001 Cpp14 0.00s
05 rofi93 Cpp14 0.00s
06 kzvd4729 Cpp14 0.00s
07 sahedsohel Cpp14 0.00s
08 motaleb_ICT Cpp14 0.00s
09 Dragon_Curve Cpp14 0.00s
10 snow_man Cpp14 0.00s
11 _c_k_r_ Cpp14 0.00s
12 emrul Cpp14 0.00s
13 moshiur_cse15 Cpp14 0.00s
14 mahbubcseju Cpp14 0.00s
15 shihabsarar29 Cpp14 0.00s
16 Aman_khan Cpp14 0.00s
17 duronto20 Cpp14 0.00s
18 bu_hridoy Cpp14 0.00s
19 AresGod Cpp14 0.00s
20 Mr_KAJOL Cpp14 0.00s
21 Avenger27 Cpp14 0.00s
22 haasib Cpp14 0.00s
23 ssavi Cpp14 0.00s
24 feodorv Cpp14 0.00s
25 pulak_ict_mbstu Cpp 0.00s
26 Morass Cpp14 0.00s
27 Robbinb1993 Cpp 0.00s
28 tariqiitju Cpp 0.00s
29 subhashis_cse Cpp14 0.01s
30 saiful130104 Cpp14 0.01s
31 badhansen123 Cpp14 0.01s
32 Saimum_140128 Cpp14 0.01s
33 bafar Cpp14 0.01s
34 reshan13 Cpp14 0.01s
35 susmoys Cpp14 0.01s
36 lsiddiqsunny Cpp14 0.01s
37 Anubis Cpp14 0.01s
38 Sleep_Mode Cpp14 0.01s
39 nuhu_iu Cpp14 0.01s
40 RandyWaterhouse Python3 0.05s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support