Advertisement
Josif_tepe

Untitled

Dec 14th, 2021
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin>>n;
  9.     int rez=0;
  10.     while(n!=0)
  11.     {
  12.         int x=n;
  13.         int cifra=0;
  14.         while(x>0)
  15.         {
  16.             cifra=max(cifra,x%10);
  17.             x/=10;
  18.         }
  19.         n-=cifra;
  20.         rez++;
  21.     }
  22.     cout<<rez;
  23.     return 0;
  24. }
  25.  
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement