Advertisement
Saleh127

CF 1283B

Aug 9th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. ios_base::sync_with_stdio(0);
  6. cin.tie(0);cout.tie(0);
  7.  
  8. int t;
  9. cin>>t;
  10. while(t--)
  11. {
  12.  
  13. int a,c,d=0,e=0,f,i,j,k,l;
  14. cin>>a>>c;
  15. d=a-(a%c);
  16. d+=min(a%c,c/2);
  17. cout<<d<<endl;
  18. }
  19. return 0;
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement