fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. float f, a, b;
  6. double p=1.5;
  7. int c;
  8. cin>>a;
  9.  
  10. if(a>=0)
  11. {
  12. c=a/p;
  13. b=a/p;
  14. a=(b-c)*p;
  15. f=a*a*a-2.25*a;
  16. }
  17. else if(a<0)
  18. {
  19. c=(-a)/p;
  20. a=(c+1)*p+a;
  21. f=a*a*a-2.25*a;
  22. }
  23. cout<<f<<endl;
  24. return 0;
  25. }
Success #stdin #stdout 0s 3276KB
stdin
2.12
stdout
-1.15667