Task: | Deleting digits |
Sender: | aalto2024e_006 |
Submission time: | 2024-09-30 16:33:50 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | TIME LIMIT EXCEEDED | -- | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
#6 | TIME LIMIT EXCEEDED | -- | details |
#7 | TIME LIMIT EXCEEDED | -- | details |
#8 | TIME LIMIT EXCEEDED | -- | details |
#9 | TIME LIMIT EXCEEDED | -- | details |
#10 | TIME LIMIT EXCEEDED | -- | details |
#11 | TIME LIMIT EXCEEDED | -- | details |
#12 | TIME LIMIT EXCEEDED | -- | details |
#13 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; int best(int x) { if (x == 0) return 0; else if (x < 0) return 99999999; //cout << x << endl; int y = x; int miny = 99999999; while (y != 0) { //cout << y << endl; if (y%10 != 0) miny = min(miny, best(x - (y%10)) + 1); y /= 10; } return miny; } int main() { int x; cin >> x; cout << best(x) << endl; }
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: TIME LIMIT EXCEEDED
input |
---|
167 |
correct output |
---|
29 |
user output |
---|
(empty) |
Test 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
4434 |
correct output |
---|
687 |
user output |
---|
(empty) |
Test 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
9722 |
correct output |
---|
1381 |
user output |
---|
(empty) |
Test 7
Verdict: TIME LIMIT EXCEEDED
input |
---|
37882 |
correct output |
---|
5406 |
user output |
---|
(empty) |
Test 8
Verdict: TIME LIMIT EXCEEDED
input |
---|
103330 |
correct output |
---|
13867 |
user output |
---|
(empty) |
Test 9
Verdict: TIME LIMIT EXCEEDED
input |
---|
562167 |
correct output |
---|
75527 |
user output |
---|
(empty) |
Test 10
Verdict: TIME LIMIT EXCEEDED
input |
---|
991919 |
correct output |
---|
127308 |
user output |
---|
(empty) |
Test 11
Verdict: TIME LIMIT EXCEEDED
input |
---|
999993 |
correct output |
---|
128206 |
user output |
---|
(empty) |
Test 12
Verdict: TIME LIMIT EXCEEDED
input |
---|
999999 |
correct output |
---|
128206 |
user output |
---|
(empty) |
Test 13
Verdict: TIME LIMIT EXCEEDED
input |
---|
23456 |
correct output |
---|
3364 |
user output |
---|
(empty) |