Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,v,sum = 0,money=0;
- cin >> n >> v;
- if(n>v)
- {
- money = v;
- int counnt = n - (v-1);
- for(int i=2; i<counnt; i++)
- {
- money = money + i;
- }
- cout << money << endl;
- return 0;
- }
- else if( v>=n)
- cout<<n-1<<endl;
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement