fork download
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. double f(double x, double y)
  6. {
  7. if ((x >= 0) && (x < 5)) return 2*x-y;
  8. if (( x<0) && (y<0)) return x*x;
  9. else return 5*y+1;
  10. }
  11.  
  12. double g(double x, double y)
  13. {
  14. double f = ((x>=0)*(x<5)+2*(y<0)*(x<0))*(2-(x>=0)*(x<5)-2*(y<0)*(x<0))*(2*x-y)+((x>=0)*(x<5)+2*(y<0)*(x<0))*((x>=0)*(x<5)+2*(y<0)*(x<0)-1)*(x*x)/2+((x>=0)*(x<5)+2*(y<0)*(x<0)-1)*((x>=0)*(x<5)+2*(y<0)*(x<0)-2)*(5*y+1)/2;
  15. return f;
  16. }
  17.  
  18. int main()
  19. {
  20. for(int i = 0; i < 100000; ++i)
  21. {
  22. double x = rand()%20-10;
  23. double y = rand()%20-10;
  24.  
  25. if (f(x,y) - g(x,y)) printf("%lf %lf\n",f(x,y),g(x,y));
  26. }
  27. }
  28.  
Success #stdin #stdout 0.01s 5364KB
stdin
Standard input is empty
stdout
Standard output is empty