flΓ’neur

Problem - 1553A - Codeforces

codeforces.com Β· saved by 1 readers

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 .

saved by