DCP-511: Strange Equation Back to All Problems

Medium Math > Basic Math


Count the number of positive integer solutions to the following equation: **A × x<sub>1</sub> × x<sub>2</sub> × x<sub>3</sub> - B × x<sub>4</sub> × x<sub>5</sub> × x<sub>6</sub> = 0** where A and B are integer coefficients, and **x<sub>i</sub>** are the variables such that **1 ≤ x<sub>i</sub> ≤ M**. Input: ------ First line contains an integer **T (1 ≤ T ≤ 1000)** denoting the number of test cases. The following T lines contain three positive integer numbers **M**, **A**, **B**. Constraint is **1 ≤ M ≤ 100** and **0 < A, B ≤ 1000000**. Output: ------- For each test case print the case number first and then print the number of solutions to the equation. Sample Input ------------ 5 2 1 1 4 1 1 97 97 11 100 64 9 100 101 1 Sample Output ------------- Case 1: 20 Case 2: 340 Case 3: 1870887 Case 4: 11368593 Case 5: 0


Problem Setter:

Feodor Volonter

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

Problem Stats

5/49

Solve/Submission

Ranking

# User Language Timing
01 Informatimukas Cpp 0.08s
02 Ryuuk Cpp 0.24s
03 feodorv C 1.56s
04 tariqiitju Cpp14 1.89s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support