Submission ID Problem Status Score Time Memory Code / Answer files User Submit time
#12915 #52. Monodigit Wrong Answer 20 490 ms 508 K C++ 17 / 2.6 K HKSC2023-048 2023-07-08 14:37:02
Show orginal code
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long n;
    long double q;
    cin >> n;
    q = n;
    if (n < 10) {
        cout << n << endl;
        return 0;
    } else if (n == 10) {
        cout << 9 << endl;
        return 0;
    } else if (n <= 100) {
        if (n != 11 and n != 22 and n != 33 and n != 44 and n != 55 and n != 66 and n != 77 and n != 88 and
            n != 99) {
            cout << 9 + (floor(q / 10) - 1) << endl;
            return 0;
        } else {
            cout << 9 + (floor(q / 10)) << endl;
            return 0;
        }
    } else if (n <= 1000) {
        if (n != 111 and n != 222 and n != 333 and n != 444 and n != 555 and n != 666 and n != 777 and
            n != 888 and n != 999) {
            cout << 9 * 2 + (floor(q / 100) - 1) << endl;
            return 0;
        } else {
            cout << 9 * 2 + (floor(q / 100)) << endl;
            return 0;
        }
    } else if (n <= 10000) {
        if (n != 1111 and n != 2222 and n != 3333 and n != 4444 and n != 5555 and n != 6666 and n != 7777 and
            n != 8888 and n != 9999) {
            cout << 9 * 3 + (floor(q / 1000) - 1) << endl;
            return 0;
        } else {
            cout << 9 * 3 + (floor(q / 1000)) << endl;
            return 0;
        }
    } else if (n <= 100000) {
        if (n != 11111 and n != 22222 and n != 33333 and n != 44444 and n != 55555 and n != 66666 and
            n != 77777 and n != 88888 and n != 99999) {
            cout << 9 * 4 + (floor(q / 10000) - 1) << endl;
            return 0;
        } else {
            cout << 9 * 4 + (floor(q / 10000)) << endl;
            return 0;
        }
    } else if (n <= 1000000) {
        if (n != 111111 and n != 222222 and n != 333333 and n != 444444 and n != 555555 and n != 666666 and
            n != 777777 and n != 888888 and n != 999999) {
            cout << 9 * 5 + (floor(q / 100000) - 1) << endl;
            return 0;
        } else {
            cout << 9 * 5 + (floor(q / 100000)) << endl;
            return 0;
        }
    } else if (n <= 10000000) {
        if (n != 1111111 and n != 2222222 and n != 3333333 and n != 4444444 and n != 5555555 and
            n != 6666666 and n != 7777777 and n != 8888888 and n != 9999999) {
            cout << 9 * 6 + (floor(q / 1000000) - 1) << endl;
            return 0;
        } else {
            cout << 9 * 6 + (floor(q / 1000000)) << endl;
            return 0;
        }
    } else if (n <= 100000000) {
        if (n != 11111111 and n != 22222222 and n != 33333333 and n != 44444444 and n != 55555555 and
            n != 66666666 and n != 77777777 and n != 88888888 and n != 99999999) {
            cout << 9 * 7 + (floor(q / 10000000) - 1) << endl;
            return 0;
        } else {
            cout << 9 * 7 + (floor(q / 10000000)) << endl;
            return 0;
        }
    } else if (n <= 1000000000) {
        if (n != 111111111 and n != 222222222 and n != 333333333 and n != 444444444 and n != 555555555 and
            n != 666666666 and n != 777777777 and n != 888888888 and n != 999999999) {
            cout << 9 * 8 + (floor(q / 100000000) - 1) << endl;
            return 0;
        } else {
            cout << 9 * 8 + (floor(q / 100000000)) << endl;
            return 0;
        }
    }
}
Subtask #1
Accepted
Score: 20
Test case #1
Accepted
Score: 100
Time: 8 ms
Memory: 368 KiB

Input file

1

Output file

1

Your output

1

System message

Exited with return code 0
Test case #2
Accepted
Score: 100
Time: 8 ms
Memory: 376 KiB

Input file

2

Output file

2

Your output

2

System message

Exited with return code 0
Test case #3
Accepted
Score: 100
Time: 8 ms
Memory: 492 KiB

Input file

3

Output file

3

Your output

3

System message

Exited with return code 0
Test case #4
Accepted
Score: 100
Time: 11 ms
Memory: 252 KiB

Input file

4

Output file

4

Your output

4

System message

Exited with return code 0
Test case #5
Accepted
Score: 100
Time: 7 ms
Memory: 248 KiB

Input file

5

Output file

5

Your output

5

System message

Exited with return code 0
Test case #6
Accepted
Score: 100
Time: 8 ms
Memory: 368 KiB

Input file

6

Output file

6

Your output

6

System message

Exited with return code 0
Test case #7
Accepted
Score: 100
Time: 9 ms
Memory: 368 KiB

Input file

7

Output file

7

Your output

7

System message

Exited with return code 0
Test case #8
Accepted
Score: 100
Time: 8 ms
Memory: 368 KiB

Input file

8

Output file

8

Your output

8

System message

Exited with return code 0
Test case #9
Accepted
Score: 100
Time: 9 ms
Memory: 252 KiB

Input file

9

Output file

9

Your output

9

System message

Exited with return code 0
Test case #10
Accepted
Score: 100
Time: 10 ms
Memory: 248 KiB

Input file

10

Output file

9

Your output

9

System message

Exited with return code 0
Subtask #2
Wrong Answer
Score: 0
Test case #1
Accepted
Score: 100
Time: 9 ms
Memory: 380 KiB

Input file

100

Output file

18

Your output

18

System message

Exited with return code 0
Test case #2
Accepted
Score: 100
Time: 8 ms
Memory: 368 KiB

Input file

1

Output file

1

Your output

1

System message

Exited with return code 0
Test case #3
Accepted
Score: 100
Time: 8 ms
Memory: 376 KiB

Input file

2

Output file

2

Your output

2

System message

Exited with return code 0
Test case #4
Accepted
Score: 100
Time: 8 ms
Memory: 492 KiB

Input file

3

Output file

3

Your output

3

System message

Exited with return code 0
Test case #5
Accepted
Score: 100
Time: 11 ms
Memory: 252 KiB

Input file

4

Output file

4

Your output

4

System message

Exited with return code 0
Test case #6
Accepted
Score: 100
Time: 7 ms
Memory: 248 KiB

Input file

5

Output file

5

Your output

5

System message

Exited with return code 0
Test case #7
Accepted
Score: 100
Time: 8 ms
Memory: 368 KiB

Input file

6

Output file

6

Your output

6

System message

Exited with return code 0
Test case #8
Accepted
Score: 100
Time: 9 ms
Memory: 368 KiB

Input file

7

Output file

7

Your output

7

System message

Exited with return code 0
Test case #9
Accepted
Score: 100
Time: 8 ms
Memory: 368 KiB

Input file

8

Output file

8

Your output

8

System message

Exited with return code 0
Test case #10
Accepted
Score: 100
Time: 9 ms
Memory: 252 KiB

Input file

9

Output file

9

Your output

9

System message

Exited with return code 0
Test case #11
Accepted
Score: 100
Time: 10 ms
Memory: 248 KiB

Input file

10

Output file

9

Your output

9

System message

Exited with return code 0
Test case #12
Accepted
Score: 100
Time: 10 ms
Memory: 376 KiB

Input file

1000000

Output file

54

Your output

54

System message

Exited with return code 0
Test case #13
Accepted
Score: 100
Time: 10 ms
Memory: 252 KiB

Input file

775812

Output file

51

Your output

51

System message

Exited with return code 0
Test case #14
Wrong Answer
Score: 0
Time: 8 ms
Memory: 248 KiB

Input file

683145

Output file

51

Your output

50

Checker message

Files user_out and answer differ

System message

Exited with return code 0
Test case #15
Accepted
Score: 100
Time: 7 ms
Memory: 256 KiB

Input file

66666

Output file

42

Your output

42

System message

Exited with return code 0
Test case #16
Accepted
Score: 100
Time: 9 ms
Memory: 364 KiB

Input file

44443

Output file

39

Your output

39

System message

Exited with return code 0
Test case #17
Wrong Answer
Score: 0
Time: 8 ms
Memory: 368 KiB

Input file

12

Output file

10

Your output

9

Checker message

Files user_out and answer differ

System message

Exited with return code 0
Test case #18
Wrong Answer
Score: 0
Time: 9 ms
Memory: 252 KiB

Input file

23

Output file

11

Your output

10

Checker message

Files user_out and answer differ

System message

Exited with return code 0
Test case #19
Accepted
Score: 100
Time: 9 ms
Memory: 508 KiB

Input file

100000

Output file

45

Your output

45

System message

Exited with return code 0
Test case #20
Accepted
Score: 100
Time: 9 ms
Memory: 380 KiB

Input file

10000

Output file

36

Your output

36

System message

Exited with return code 0
Subtask #3
Wrong Answer
Score: 0
Test case #1
Accepted
Score: 100
Time: 9 ms
Memory: 380 KiB

Input file

100

Output file

18

Your output

18

System message

Exited with return code 0
Test case #2
Accepted
Score: 100
Time: 8 ms
Memory: 368 KiB

Input file

1

Output file

1

Your output

1

System message

Exited with return code 0
Test case #3
Accepted
Score: 100
Time: 8 ms
Memory: 376 KiB

Input file

2

Output file

2

Your output

2

System message

Exited with return code 0
Test case #4
Accepted
Score: 100
Time: 8 ms
Memory: 492 KiB

Input file

3

Output file

3

Your output

3

System message

Exited with return code 0
Test case #5
Accepted
Score: 100
Time: 11 ms
Memory: 252 KiB

Input file

4

Output file

4

Your output

4

System message

Exited with return code 0
Test case #6
Accepted
Score: 100
Time: 7 ms
Memory: 248 KiB

Input file

5

Output file

5

Your output

5

System message

Exited with return code 0
Test case #7
Accepted
Score: 100
Time: 8 ms
Memory: 368 KiB

Input file

6

Output file

6

Your output

6

System message

Exited with return code 0
Test case #8
Accepted
Score: 100
Time: 9 ms
Memory: 368 KiB

Input file

7

Output file

7

Your output

7

System message

Exited with return code 0
Test case #9
Accepted
Score: 100
Time: 8 ms
Memory: 368 KiB

Input file

8

Output file

8

Your output

8

System message

Exited with return code 0
Test case #10
Accepted
Score: 100
Time: 9 ms
Memory: 252 KiB

Input file

9

Output file

9

Your output

9

System message

Exited with return code 0
Test case #11
Accepted
Score: 100
Time: 10 ms
Memory: 248 KiB

Input file

10

Output file

9

Your output

9

System message

Exited with return code 0
Test case #12
Accepted
Score: 100
Time: 10 ms
Memory: 376 KiB

Input file

1000000

Output file

54

Your output

54

System message

Exited with return code 0
Test case #13
Accepted
Score: 100
Time: 10 ms
Memory: 252 KiB

Input file

775812

Output file

51

Your output

51

System message

Exited with return code 0
Test case #14
Wrong Answer
Score: 0
Time: 8 ms
Memory: 248 KiB

Input file

683145

Output file

51

Your output

50

Checker message

Files user_out and answer differ

System message

Exited with return code 0
Test case #15
Accepted
Score: 100
Time: 7 ms
Memory: 256 KiB

Input file

66666

Output file

42

Your output

42

System message

Exited with return code 0
Test case #16
Accepted
Score: 100
Time: 9 ms
Memory: 364 KiB

Input file

44443

Output file

39

Your output

39

System message

Exited with return code 0
Test case #17
Wrong Answer
Score: 0
Time: 8 ms
Memory: 368 KiB

Input file

12

Output file

10

Your output

9

Checker message

Files user_out and answer differ

System message

Exited with return code 0
Test case #18
Wrong Answer
Score: 0
Time: 9 ms
Memory: 252 KiB

Input file

23

Output file

11

Your output

10

Checker message

Files user_out and answer differ

System message

Exited with return code 0
Test case #19
Accepted
Score: 100
Time: 7 ms
Memory: 368 KiB

Input file

1000000000

Output file

81

Your output

81

System message

Exited with return code 0
Test case #20
Accepted
Score: 100
Time: 7 ms
Memory: 368 KiB

Input file

999999998

Output file

80

Your output

80

System message

Exited with return code 0
Test case #21
Accepted
Score: 100
Time: 7 ms
Memory: 368 KiB

Input file

701177988

Output file

78

Your output

78

System message

Exited with return code 0
Test case #22
Accepted
Score: 100
Time: 7 ms
Memory: 368 KiB

Input file

431496282

Output file

75

Your output

75

System message

Exited with return code 0
Test case #23
Wrong Answer
Score: 0
Time: 7 ms
Memory: 368 KiB

Input file

383933636

Output file

75

Your output

74

Checker message

Files user_out and answer differ

System message

Exited with return code 0
Test case #24
Wrong Answer
Score: 0
Time: 7 ms
Memory: 240 KiB

Input file

343821327

Output file

75

Your output

74

Checker message

Files user_out and answer differ

System message

Exited with return code 0
Test case #25
Accepted
Score: 100
Time: 7 ms
Memory: 236 KiB

Input file

100000000

Output file

72

Your output

72

System message

Exited with return code 0
Test case #26
Accepted
Score: 100
Time: 7 ms
Memory: 248 KiB

Input file

10000000

Output file

63

Your output

63

System message

Exited with return code 0
Test case #27
Accepted
Score: 100
Time: 9 ms
Memory: 508 KiB

Input file

100000

Output file

45

Your output

45

System message

Exited with return code 0
Test case #28
Accepted
Score: 100
Time: 9 ms
Memory: 380 KiB

Input file

10000

Output file

36

Your output

36

System message

Exited with return code 0