Lucian_Adrian

974 Resturi

Oct 5th, 2021
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. unsigned long long n,x,y,s=0,k;
  6. cin>>n>>k;
  7. cout<<(n/k)*(((k-1)*k)/2)+(n%k)*(n%k+1)/2;
  8. return 0;
  9. }
Advertisement
Add Comment
Please, Sign In to add comment