fork download
  1. #include <cstdio>
  2. #include <cmath>
  3.  
  4. int main() {
  5. double a;
  6. if (scanf("%lf", &a) != 1) return 0;
  7.  
  8. double x = fmod(a, 1.5); // (-1.5, 1.5)
  9. if (x < 0) x += 1.5; // [0, 1.5)
  10.  
  11. double ans = x * x * x - 2.25 * x; // [0,1.5]-д үргэлж <= 0
  12.  
  13. long long t = -(long long)floor(-ans * 10.0 + 1e-9);
  14.  
  15. if (t == 0) {
  16. printf("0.0\n");
  17. } else {
  18. long long s = t < 0 ? -t : t;
  19. printf("%s%lld.%lld\n", t < 0 ? "-" : "", s / 10, s % 10);
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty