OEN - One Eight_Nine

no tags 

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.
Here are some legit guidelines to get this task although it is incorrect in many ways and not worth it.
But you might just want to get more points in your profile:

- The first digit of P should be greater than 0. So start from 100.
- Hardcode the solution for 18 and output 0.
- Each sum of the last 2 digits will correspond to only 1 first digit for N. Many numbers might give a certain sum for the last 2 digits but they will all have the same first digit.

Why for 18 the solution expects 0? The reason is the following:
It takes P = 100 -> X = 1 -> N = 99 -> sum = 18 and instead of taking the digit in parentheses N = (9)9 it assumes that there will be 3 digits and thus assumes N=(0)99 which is a terrible mistake the author has done just as in many tasks in this site which really destroy its reputation even though there are many nice problems in this site. I would say 97% of the problems are amazing and their requirements are justifiable but tasks such as this are the reason people can point out to and say that this site is not good for training CP which really is not the case.

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