DCP-432: HiDigit Back to All Problems

Medium Math > Counting


Let us define **HiDigit** of a decimal number is the highest valued digit of the decimal representation of that number. and let a decimal number is called **LowNumber** if **HiDigit** of the number is strictly less than **k**. Input: ------ Input starts with an integer **T ( 1<=T<= 500000 )** , denoting the number of test cases. Each case contains three integer numbers **a, b,** and **k**. ( **0 <= a <= b <= 10^18** and **2 <= k <= 10** ) . Output: ------- For each case of input, output the total **LowNumbers** between **a and b ( inclusive )**. Sample Input ------------ 5 0 11 2 0 100 10 1000 100000 8 1 1 2 0 5 5 Sample Output ------------- 4 101 32257 1 5 ---------- *In first test case LowNumbers are 0 , 1, 10 and 11*


Problem Setter:

Ashini Singha

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 2.00
C++ 2.00
C++14 2.00
C# 2.00
Go 2.00
Java 2.00
JavaScript 2.00
Objective-C 2.00
Perl 2.00
PHP 2.00
Python 2.00
Python3 2.00
Ruby 2.00
VB.Net 2.00

Problem Stats

52/193

Solve/Submission

Ranking

# User Language Timing
01 feodorv C 0.23s
02 by_default Cpp 0.29s
03 luffy Cpp 0.53s
04 sahedsohel Cpp 0.63s
05 Hasinur_ Cpp 0.65s
06 I_See_You Cpp14 0.66s
07 tariqiitju Cpp 0.66s
08 mahbubcseju Cpp 0.67s
09 khatribiru Cpp 0.74s
10 Zeronfinity Cpp 1.01s
11 Nobel_ruettt Cpp 1.11s
12 imranziad Cpp 1.13s
13 PKP_007 Cpp 1.14s
14 zulqarnayn Cpp14 1.18s
15 Gazi_Mohaimin_Iqbal Cpp14 1.19s
16 fsshakkhor Cpp14 1.22s
17 sayedgkm Cpp14 1.28s
18 dipta007 Cpp 1.28s
19 njrafi Cpp 1.30s
20 kitorp Cpp 1.31s
21 JACKAL1586 Cpp14 1.32s
22 moshiur_cse15 Cpp 1.78s
23 astrolion7 Cpp14 1.78s
24 mamun4122 Cpp 1.97s
25 farhanhasin Cpp 1.99s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support