DCP-121: My Girlfriends Back to All Problems

Easy Beginners Problems > Ad-hoc


Do you know a secret thing about me? That I have millions of Girlfriends. I was just joking. Let say I have **N** girlfriends. As I have a lot of them, I memorize them with their id. Girlfriend with id **k** (Girlfriends are numbered from 1 to N) will be available for the days of range **[(K - 1) * M, (K - 1) * M + L]**, and **L < M**. I am passing my days from day 0. As I am a student I study for **D** days and go on a date with my available girlfriend at every Dth day. Find out the day, when I won't have any girlfriend for a date for the first time. Input: ------ Input starts with an integer **T (T ≤ 35)** denoting the number of test cases. Each test case contains **4** integer numbers **N, D, M, L (1 ≤ N, D, M, L ≤ 10^6, L < M)**. Output: ------- For each test print case number and the day when I won't have any girlfriend for a date for the first time. Sample Input ------------ 2 2 2 5 3 5 4 11 8 Sample Output ------------- Case 1: 4 Case 2: 20


Problem Setter:

Feroz Ahmmed

Please login to submit solution to this problem.

Problem Limits

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

Problem Stats

31/246

Solve/Submission

Ranking

# User Language Timing
01 feodorv C 0.01s
02 Madhab Cpp 0.14s
03 prateepm Cpp14 0.14s
04 Morass Cpp14 0.15s
05 tariqiitju Cpp 0.15s
06 Ishrak Cpp14 0.21s
07 murad_al_wajed Cpp14 0.22s
08 Saimum_140128 Cpp14 0.35s
09 rayhan50001 Cpp14 0.37s
10 kazinayeem Cpp14 0.45s
11 dmehrab06 Cpp14 0.53s
12 nuhu_iu Cpp14 0.61s
13 MRoy Cpp14 0.62s
14 froghramar Cpp14 0.62s
15 rofi93 Cpp14 0.63s
16 xpo6 Cpp14 0.64s
17 akazad_cse13_ruet Cpp14 0.64s
18 as_couple Cpp14 0.64s
19 jayanto Cpp14 0.65s
20 deder Cpp14 0.66s
21 rajdipsaha Cpp14 0.68s
22 ssavi Cpp14 0.70s
23 KIRIN_36 Cpp14 0.71s
24 MI47 Cpp14 0.72s
25 dipta007 Cpp14 0.73s
26 ahqmrf Cpp14 0.81s
27 Mahmudul_Tushar Cpp14 0.84s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support