fork download
  1. #include <iostream>
  2. using namespace std;
  3. using ll = int64_t;
  4.  
  5. int main() {
  6. // your code goes here
  7. int n;
  8. cin >> n;
  9. ll ans=0;
  10. for(int i=1;i<n;i++){
  11. for(int j=i+1;j<2*i;j++){
  12. if(n-i-j>=2*i){
  13. ans--;
  14. }
  15. if(n-i-j<=j){
  16. break;
  17. }
  18. ans++;
  19. }
  20. }
  21. cout << ans << endl;
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5652KB
stdin
6000
stdout
299401