Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n,v,sum = 0,money=0;
  8. cin >> n >> v;
  9.  
  10. if(n>v)
  11. {
  12.  
  13. money = v;
  14.  
  15. int counnt = n - (v-1);
  16.  
  17. for(int i=2; i<counnt; i++)
  18. {
  19. money = money + i;
  20. }
  21. cout << money << endl;
  22. return 0;
  23. }
  24. else if( v>=n)
  25. cout<<n-1<<endl;
  26. return 0;
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement