Addition Errors
Practice
3.6 (38 votes)
Basic programming
Basics of implementation
Cakewalk
Easy
Implementation
Problem
37% Success 7328 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Bob is a noob mathematician and he is not very comfortable with addition of numbers.He is unaware of the concept of carry that the addition of 2 numbers possess.He everytime forgets to take a carry while performing addition.

Example: suppose he adds 5 and 8 so he writes only 3 instead of 13. Similarly while adding 18 and 223 he writes it as 231.

So basically he ignores the carry everytime.You task is to compute the error in his addition algorithm.

Error is defined as the absolute difference between Bob's answer and the actual answer which was expected.

Input Format

First line contains T (the number of Test Cases).

Each testcase contains 2 lines containing numbers A and B.(the numbers which Bob uses to perform an addition).

Output Format

For each testcase print the error value in a new line.

Constraints

\(1 \le T \le 10^5\)

\(1 \le A,B \le 10^{18}\)

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

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
22 votes
Tags:
ApprovedEasyMathOpenPrimality test
Points:20
23 votes
Tags:
Ad-HocEasyImplementationMath
Points:20
34 votes
Tags:
Ad-HocApprovedEasyOpen