Codeforces 1328 A. Divisibility Problem Solution

  1. Solution in C++:
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. int main()
  5. {
  6. int t,n,i,a,b,c;
  7. cin>>t;
  8. while(t--)
  9. {
  10.  
  11. cin>>a>>b;
  12. if(a%b!=0)
  13. {
  14. c=b-(a%b);
  15. cout<<c<<endl;
  16. }
  17. else
  18. cout<<"0"<<endl;
  19.  
  20. }
  21. }

No comments

Most View Post

Recent post

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.