DCP-213: BPL of next century Back to All Problems

Medium Math > Modular Arithmetic


After being very successful event over a century , now BPL is very popular not only within the earth but also all over the universe. BCB planning to arrange it as an international event where there will be team from every planet. So its gonna be a very big event and Mr. Papon (President of BCB) is curious to know if they allow **N** teams how many matches they’re gonna need to arrange only for very 1st round? As you’re a famous programmer Mr. Papon needs your help. As you know , in BLP each team play with every other team exactly **K** times. (do not play with itself) And as answer is gonna be very big you have to print answer modulo **M**. Input: ------ 3 Integer N,K,M [separated by space] in a line for every test cases. Input will terminated by EOF. Output: ------- Print Case X: Y in a line for each test cases. Where X is case number and Y is answer. **Constrain :** **1 < N,M < 2^64, 1 <= K < 2^64** . there will be **at most 27005 test cases**. Sample Input : -------------- 8 2 1000 8 2 50 100 100 99 100 100 97 100 100 1000000000 7 2 100 Sample Output: -------------- Case 1: 56 Case 2: 6 Case 3: 0 Case 4: 9 Case 5: 495000 Case 6: 42


Problem Setter:

Md. Tariqul Islam

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

23/160

Solve/Submission

Ranking

# User Language Timing
01 tariqiitju Cpp14 0.02s
02 sahedsohel Cpp14 0.04s
03 mahbubcseju Cpp14 0.04s
04 feodorv Cpp14 0.04s
05 Robbinb1993 Cpp 0.04s
06 int_elligent C 0.05s
07 leenaiitju Cpp 0.08s
08 RandyWaterhouse Python3 0.15s
09 Morass Cpp14 0.20s
10 prateepm Python3 0.24s
11 _dipu Java 1.29s
12 sujan13 Java 1.73s
13 rayhan50001 Java 1.87s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support