A special number
Practice
3 (29 votes)
Basic programming
C++
Problem
83% Success 9278 Attempts 10 Points 1s Time Limit 256MB Memory 1024 KB Max Code
A number \(n\) is said to be special if the sum of its digits is divisible by 4.
For a given integer \(a\), find a number \(n\) such that:
- \(n\) is a special number
- \(n \ge a\)
- \(n\) is minimum possible
Input format
- The first line contains an integer \(T\) denoting the number of test cases.
- For each test case:
- The first line contains an integer \(a\).
Output format
For each test case, print a number \(n\) that satisfies the above conditions in a new line.
Constraints
\(1 \le T \le 10^ 5\)
\(1 \le a \le 10^3\)
Explanation
For first test case:
- n = 435, sum of digits is 12 which is divisible by 4.
For second test case:
- n = 103, sum of digits is 4 which is divisible by 4.
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:10
20 votes
Tags:
Basic ProgrammingBasic MathAlgorithmsNumber theory
Points:10
75 votes
Tags:
Basic ProgrammingBasics of ImplementationImplementationMath
Points:10
51 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
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