Advertisement
cupsamada

resturi2

Nov 14th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n, k;
  6. long long suma, p=0;
  7. cin>>n>>k;
  8. if(n%k==0)
  9. {
  10. p=n/k;
  11. }
  12. else
  13. {
  14. p=(n/k)+1;
  15. }
  16. suma=p*((k-1)*k/2);
  17. cout<<suma;
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement