| Task: | Deleting digits |
| Sender: | erikpeik |
| Submission time: | 2025-09-29 16:38:54 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | RUNTIME ERROR |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.04 s | details |
| #2 | ACCEPTED | 0.04 s | details |
| #3 | ACCEPTED | 0.04 s | details |
| #4 | ACCEPTED | 0.04 s | details |
| #5 | ACCEPTED | 0.05 s | details |
| #6 | ACCEPTED | 0.06 s | details |
| #7 | RUNTIME ERROR | 0.11 s | details |
| #8 | RUNTIME ERROR | 0.11 s | details |
| #9 | RUNTIME ERROR | 0.11 s | details |
| #10 | RUNTIME ERROR | 0.11 s | details |
| #11 | RUNTIME ERROR | 0.11 s | details |
| #12 | RUNTIME ERROR | 0.11 s | details |
| #13 | RUNTIME ERROR | 0.11 s | details |
Code
def del_digits(n, count=0, last_digit=None):
if n == 0:
return count
digits_str = str(n)
digits = [int(d) for d in digits_str]
for digit in sorted(set(digits), reverse=True):
new_n = n - digit
if new_n >= 0 and new_n < n:
return del_digits(new_n, count + 1, digit)
return count
if __name__ == "__main__":
n = int(input())
print(del_digits(n))
Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 4 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 2
Verdict: ACCEPTED
| input |
|---|
| 17 |
| correct output |
|---|
| 3 |
| user output |
|---|
| 3 |
Test 3
Verdict: ACCEPTED
| input |
|---|
| 35 |
| correct output |
|---|
| 7 |
| user output |
|---|
| 7 |
Test 4
Verdict: ACCEPTED
| input |
|---|
| 167 |
| correct output |
|---|
| 29 |
| user output |
|---|
| 29 |
Test 5
Verdict: ACCEPTED
| input |
|---|
| 4434 |
| correct output |
|---|
| 687 |
| user output |
|---|
| 687 |
Test 6
Verdict: ACCEPTED
| input |
|---|
| 9722 |
| correct output |
|---|
| 1381 |
| user output |
|---|
| 1381 |
Test 7
Verdict: RUNTIME ERROR
| input |
|---|
| 37882 |
| correct output |
|---|
| 5406 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 19, in <module>
print(...Test 8
Verdict: RUNTIME ERROR
| input |
|---|
| 103330 |
| correct output |
|---|
| 13867 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 19, in <module>
print(...Test 9
Verdict: RUNTIME ERROR
| input |
|---|
| 562167 |
| correct output |
|---|
| 75527 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 19, in <module>
print(...Test 10
Verdict: RUNTIME ERROR
| input |
|---|
| 991919 |
| correct output |
|---|
| 127308 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 19, in <module>
print(...Test 11
Verdict: RUNTIME ERROR
| input |
|---|
| 999993 |
| correct output |
|---|
| 128206 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 19, in <module>
print(...Test 12
Verdict: RUNTIME ERROR
| input |
|---|
| 999999 |
| correct output |
|---|
| 128206 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 19, in <module>
print(...Test 13
Verdict: RUNTIME ERROR
| input |
|---|
| 23456 |
| correct output |
|---|
| 3364 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 19, in <module>
print(...