OEN - One Eight_Nine
Suppose you have a number of three digits, which is P. Add those three digits and store in X. Then subtract X from the actual number P. After Subtraction, now the resulting number is N. In this problem, you are given sum of last two digits of N. Your task is to find the first digit of N.
For example, suppose P = 123, X = 1+2+3 = 6, N = P - X =123 - 6 = 117. Sum of last two digits is 8. So, in this case, first digit is 1
Input
Input starts with an integer T (1<=1000000), denoting the number of test cases. Each case contains sum of last two digits of N (0 ≤ N ≤ 18).
Output
For each test case, output one line containing "Case x: M", where x is the test case number, M is the first digit of N.
Example
Input: 2 8 13 Output: Case 1: 1 Case 2: 5
hide comments
Rafail Loizou:
2023-08-21 18:34:15
Terrible problem and some comments here are misguiding as well.
|
|
anonymous:
2021-10-04 18:57:16
To pass I had to make an assumption that N is padded with zeros to three digits. Whereas for P=100, we have N = 99, and sum of digits M = 18, so the answer should be 9 (since the first digit is 9). The judge solution is incorrect. |
|
vineetjai:
2020-09-16 13:11:35
P, N should be small as possible. |
|
robosapien:
2020-06-24 02:18:49
nice and simple. :) |
|
redblade098:
2019-12-19 08:08:51
@tsrvineel check for 100, 101,102,103,104,105,106,107,109. for N=18 output should be 0
|
|
tsrvineel:
2019-12-13 12:21:54
This question's solution is wrong. The answer for N=18 must be 9 not 0. |
|
shikhargup_19:
2019-10-24 19:49:48
what is the answer for sum=0 and sum=18 respectively? |
|
shivansh19:
2019-10-22 19:57:31
there is a sequence make between 100,200..........900 check upto that very simple question
|
|
jais_sat_19:
2019-10-17 07:23:49
can anyone help..??? not getting AC ...but working in ideon |
Added by: | Bappy |
Date: | 2019-10-07 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |