Guest User

Untitled

a guest
May 24th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. long long s, sum;
  7. int n;
  8. cin >> s;
  9. n = sqrt(2 * s);
  10. while (n*(n + 1) / 2 > s) {
  11. n--;
  12. }
  13. cout << n << '\n';
  14. return 0;
  15. }
Add Comment
Please, Sign In to add comment