Advertisement
MathQ_

Untitled

Nov 24th, 2020
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int n, k;
  8.     cin >> n >> k;
  9.     int _max = 0, i = 0;
  10.     int ans = 0;
  11.     while (n > 0) {
  12.         if (n % 10 != k) {
  13.             // cout << ans << endl;
  14.             // cout << n % 10 * pow(10, i) << endl;
  15.             // cout << ans + n % 10 * pow(10, i) << endl;
  16.             ans += n % 10 * pow(10, i);
  17.             ++i;
  18.         }
  19.         n /= 10;
  20.     }
  21.     if (ans) {
  22.         cout << ans;
  23.     } else {
  24.         cout << "NO";
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement