Saleh127

Untitled

Apr 15th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. long long a,b,c,d,e,f,i,j,k,l;
  6. cin>>a>>b;
  7. for(i=1;i<=a;i++)
  8. {
  9. c=i*(i+1)/2;
  10. if(c-(a-i)==b)
  11. {
  12. cout<<a-i<<endl;
  13. return 0;
  14. }
  15. }
  16. return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment