Question paper
Practice
3.6 (61 votes)
Ad Hoc
Algorithms
Breadth first search
Easy
Graphs
Problem
39% Success 15958 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\)
Explanation
For test case 1, you will get 0 for not attempting any question, 4 for the correct answer, and -3 for the wrong answer
For test case 2, you will get -2, -1, 0, 1, 2
Code Editor
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Submissions
Please login to view your submissions
Similar Problems
Points:30
444 votes
Tags:
Breadth First SearchDepth First SearchDynamic ProgrammingEasyGraphsMathNumber Theory
Points:30
13 votes
Tags:
ApprovedBreadth First SearchEasyGraphs
3.Graphs
Points:30
14 votes
Tags:
AlgorithmsBreadth First SearchC++Depth First SearchEasyGraphs
Editorial
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor