Advertisement
Guest User

Untitled

a guest
Sep 26th, 2014
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include<iostream>
  2. #include<stdio.h>
  3. #include<vector>
  4. #define pb push_back
  5. #define ll long long
  6. using namespace std;
  7. ll ans, n, m = 1;
  8. int main()
  9. {
  10. ios_base::sync_with_stdio(false);
  11. cin >> n;
  12. while(true)
  13. {
  14. ll cur = 3 * ((m * (m + 1)) / 2) - m;
  15. if(cur > n)
  16. break;
  17. if((n - cur) % 3 == 0)
  18. ans++;
  19. m++;
  20. }
  21. cout << ans;
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement