SHARE
TWEET

Untitled

a guest Feb 16th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top