SHARE
TWEET

A Cf

Niloy007 Mar 26th, 2020 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int t, a, b, result = 0;
  6.     cin >> t;
  7.     while(t--) {
  8.         cin >> a >> b;
  9.         if(a < b) {
  10.             result = b - a;
  11.         } else {
  12.             int c = a % b;
  13.             if(c == 0) {
  14.                 result = c;
  15.             } else {
  16.                 result = b - c;
  17.             }
  18.         }
  19.         cout << result << "\n";
  20.     }
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top