Saleh127

CF 1213C

Jul 28th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define fellow_junior ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. int main()
  7. {
  8. fellow_junior
  9. test
  10. {
  11. ll a,n,m,c,d,e,i,j,k,l;
  12. cin>>n>>m;
  13. a=n/m;
  14. c=0;
  15. for(i=1;i<10;i++)
  16. {
  17. c+=((i*m)%10)*(a/10);
  18. }
  19. for(i=1;i<=a%10;i++)
  20. {
  21. c+=(i*m)%10;
  22. }
  23. cout<<c<<endl;
  24. }
  25. return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment