Problem - 1553A - Codeforces
Let's define S(x) π ( π₯ ) to be the sum of digits of number x π₯ written in decimal system. For example, S(5)=5 π ( 5 ) = 5 , S(10)=1 π ( 10 ) = 1 , S(322)=7 π ( 322 ) = 7 . We will call an integer x π₯ interesting if S(x+1)<S(x) π ( π₯ + 1 ) < π ( π₯ ) . In each test you will be given one integer n π . Your task is to calculate the number of integers x π₯ such that 1β€xβ€n 1 β€ π₯ β€ π and x π₯ is interesting. The first line contains one integer t π‘ ( 1β€tβ€1000 1 β€ π‘ β€ 1000 ) Β β number of test cases. Then t π‘ lines follow, the i π -th line contains one integer n π ( 1β€nβ€ 10 9 1 β€ π β€ 10 9 ) for the i π -th test case. Print t π‘ integers, the i π -th should be the answer for the i π -th test case. The first interesting number is equal to 9 9 .