josiftepe

Untitled

Nov 7th, 2020
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <fstream>
  4. using namespace std;
  5. const int MOD = 1e9 + 7;
  6.  
  7.  
  8.  
  9.  
  10.  
  11. int main(){
  12.     int n,num=0;
  13.     cin>>n;
  14.     int k=n,cif=0;
  15.     while (n>0){
  16.         cif=0;
  17.         for (int k=n;k>0;k=k/10){
  18.             cif=max(cif,k%10);
  19.         }
  20.         n=n-cif;
  21.         num++
  22.     ;}
  23.     cout<<num;
  24. }
  25. //869167734
  26. //869167734
  27.  
Advertisement
Add Comment
Please, Sign In to add comment