Submission details
Task:Deleting digits
Sender:discape
Submission time:2025-09-29 16:30:08 +0300
Language:C++ (C++20)
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#3ACCEPTED0.00 sdetails
#4ACCEPTED0.00 sdetails
#5ACCEPTED0.00 sdetails
#6ACCEPTED0.00 sdetails
#7ACCEPTED0.00 sdetails
#8ACCEPTED0.01 sdetails
#9ACCEPTED0.01 sdetails
#10ACCEPTED0.02 sdetails
#11ACCEPTED0.02 sdetails
#12ACCEPTED0.02 sdetails
#13ACCEPTED0.00 sdetails

Code

#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
// clang-format off
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { T value; is >> value; v.push_back(value); return is; }
#define preamble ios::sync_with_stdio(0); cin.tie(0); dbg("INIT");
// clang-format on
#ifdef DO_DBG
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
template <typename T> using v = vector<T>;
template <typename T> using us = unordered_set<T>;
template <typename K, typename V> using um = unordered_map<K, V>;
constexpr int MOD = 1e9 + 7;
const int INF = 1e9;
const ld EPS = 1e-9;
#define loopi(n) for (int i = 0; i < n; i++)
#define loopj(n) for (int j = 0; j < n; j++)
#define loopk(n) for (int k = 0; k < n; k++)
#define loopz(n) for (int z = 0; z < n; z++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define sq(x) ((x) * (x))

int main() {
  int n;
  cin >> n;
  int i = 0;
  while (n > 0) {
    v<int> digits;
    int z = n;
    while (z != 0) {
      digits.push_back(z % 10);
      z /= 10;
    }
    // dbg(digits);
    n -= *max_element(all(digits));
    // dbg(n);
    i++;
  }
  cout << i << "\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: ACCEPTED

input
37882

correct output
5406

user output
5406

Test 8

Verdict: ACCEPTED

input
103330

correct output
13867

user output
13867

Test 9

Verdict: ACCEPTED

input
562167

correct output
75527

user output
75527

Test 10

Verdict: ACCEPTED

input
991919

correct output
127308

user output
127308

Test 11

Verdict: ACCEPTED

input
999993

correct output
128206

user output
128206

Test 12

Verdict: ACCEPTED

input
999999

correct output
128206

user output
128206

Test 13

Verdict: ACCEPTED

input
23456

correct output
3364

user output
3364