Advertisement
193030

Div 3 A. Wrong subtraction

Jul 20th, 2020
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. // https://codeforces.com/contest/977/problem/A
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5. int main()
  6. {
  7.   int n = 0, k =0;
  8.   cin >> n >> k;
  9.   while(k--)
  10.   {
  11.       if(n%10==0)
  12.       {
  13.           n /=10;
  14.       }
  15.       else
  16.       {
  17.           n--;
  18.       }
  19.   }
  20.   cout << n;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement