#include <stdio.h> #include <math.h> double zxd(double x); int main () { double x; int t; scanf("%d", &t); while (t--) { scanf("%lf",&x); double y = zxd(x); printf("%.2lf\n",y); } return 0; } double zxd(double x) { double y; if((x > 0)&&(x < 10)) { y = log2(x); } else if(x < 0) { y = fabs(x)+sin(x); } else if(x == 0) { y = 0.00; } else { y = x * x; } return y; }
分段函数
最新推荐文章于 2021-12-19 14:38:58 发布