fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. long long N, sum, subsidiary = 0, quantity = 0;
  7. cin >> N;
  8. while (N > 999999999)
  9. {
  10. sum = 0;
  11. subsidiary = N;
  12. while (subsidiary!=0)
  13. {
  14. sum += subsidiary%10;
  15. subsidiary /= 10;
  16. }
  17. N -= sum;
  18. quantity++;
  19. }
  20. if (N == 999999999)
  21. {
  22. N = 0;
  23. quantity += 25632473;
  24. }
  25. while (N > 0)
  26. {
  27. sum = 0;
  28. subsidiary = N;
  29. while (subsidiary != 0)
  30. {
  31. sum += subsidiary%10;
  32. subsidiary /= 10;
  33. }
  34. N -= sum;
  35. quantity++;
  36. }
  37. cout << quantity << endl;
  38. return 0;
  39. }
Success #stdin #stdout 0s 4400KB
stdin
Standard input is empty
stdout
0