Question paper
Practice
3.6 (61 votes)
Ad Hoc
Algorithms
Breadth first search
Easy
Graphs
Problem
39% Success 15949 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code
A question paper contains \(N\) questions. The marks assigned to each correct answer is \(a\). For each incorrect answer, you will lose \(b\) marks. Find the number of different marks that can be obtained in the examination.
Note: An unattempted question is awarded \(0\) marks.
Input format
- First line: \(T\) denoting the number of test cases
- Each of the next \(T\) lines: Three space-separated integers \(N\), \(a\) , and \(b\)
Output format
- Print the answer to each test case in a different line. (The number of different marks that one can score in an examination).
Constraints
\(1 \le T \le 50\)
\(1 \le N \le 5*10^4\)
\(1 \le a,b \le 20\)
Submissions
Please login to view your submissions
Similar Problems
Points:30
43 votes
Tags:
AlgorithmsBreadth First SearchEasyGraphs
Points:30
444 votes
Tags:
Breadth First SearchDepth First SearchDynamic ProgrammingEasyGraphsMathNumber Theory
Points:30
13 votes
Tags:
ApprovedBreadth First SearchEasyGraphs
Editorial