SHARE
TWEET

Untitled

a guest Jun 20th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. long long range(long long x,long long n)
  2. {
  3. vector<long long>op;
  4. op.push_back(x);
  5. sort(op.begin(),op.end());
  6. long long pre=1,final=op[1]-1,sum=0;
  7. for(i=0;i<op.size()-1;i++)
  8. {
  9. sum=sum+pre+final;
  10. pre=op[i]+1;
  11. final=op[i+2]-1;
  12. }
  13. long long k=op.size();
  14. sum+=op[k-2]+1+N;
  15. return sum;
  16. }
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