Advertisement
a53

caramele

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