皮皮学,免费搜题
登录
搜题
【简答题】
分段函数 时间限制 : 1 Sec 内存限制 : 128 MB [ 提交 ] 题目描述 输入 先输入一个整数 n ,表示后面总共要输入 n 组测试数据; 然后输入 n 组测试数据,每组测试数据是一个双精度浮点数 x 。 输出 根据输入的 n 组测试数据,对应输出 n 个输出结果,每个输出结果单独占一行,即每个输出结果后要加换行符。 样例输入 3 25 -2 49 样例输出 y=125.000000 y=1.000000 y=6.000000 针对上面的问题,编写不完整程序如下,请填空。程序可点击题头位置的“【提交】”,在 ACM 网站提交。 方法一:采用if-else结构 #include #include int main(void) { int n; double x,y; scanf("%d",&n); while(n--) { scanf("%lf",&x); if(________) y=(________)/2; else if(x<10) y=3+exp(x); else if(x<20) y=log10(x); else if(x<30) y=pow(x,1.5); else if(x<50) y=sqrt(x)-1; else y=3*cos(x); printf("y=%lf\n",y); } return 0; } 方法二:采用 switch 结构 #include #include int main(void) { int n,t; double x,y; scanf("%d",&n); for(;n>0;n--) { scanf("%lf",&x); t=x/10; if(x<0) t=_______; switch(t) { case -1:y=fabs(x)/2;_______; case 0:y=3+exp(x);break; case 1:y=log10(x);break; case 2:y=pow(x,1.5);break; case 3: case 4:y=sqrt(x)-1;break; default:y=3*cos(x); } printf("y=%lf\n",y); } return 0; }
拍照语音搜题,微信中搜索"皮皮学"使用
参考答案:
参考解析:
知识点:
.
..
皮皮学刷刷变学霸
举一反三
【简答题】x与y的差的5倍与2的和是一个非负数,可表示为 (      ) A. B. C. D.
【简答题】用不等式表示: (1)x与2的和小于5______.(2)a与b的差是非负数______.
【简答题】用不等式表示: ①x的2倍与5的差不大于1; ②x的 与x的 的和是非负数; ③a与3的和的30%不大于5; ④a的20%与a的和不小于a的3倍与3的差。
【多选题】Which two statements are true regarding the USING and ON clauses in table joins?()
A.
Both USING and ON clauses can be used for equijoins and nonequijoins
B.
Amaximum of one pair of columns can be joined between two tables using the ON clause
C.
The ON clause can be used to join tables on columns that have different names but compatible data types
D.
The WHERE clause can be used to apply additional conditions in SELECT statements containing the ON or the USING clause
【单选题】用不等式表示“x的3倍与2的差是非负数”正确的是(  )
A.
3x-2>0
B.
3x-2≥0
C.
3x-2<0
D.
3x-2≤0
【单选题】In India you will be advised against using the left hand for passing food at table because ______.
A.
it is considered dirty
B.
it symbolizes something unlucky
C.
it is supposed to be used for shaking hands with a friend
D.
it signifies disagreement
【简答题】用不等式表示: ①x的2倍与5的差不大于1;②x的 1 3 与x的 1 2 的和是非负数 ③a与3的和的30%不大于5;④a的20%与a的和不小于a的3倍与3的差.
【单选题】操作技能试题考核要求主要包括试题分值、()、考核具体要求和否定项说明等内容。
A.
考核时间
B.
考场准备
C.
考生准备
D.
考评员要求
【简答题】Questions 33-36 Complete the table using NO MORE THAN THREE WORDS for each answer. 【33】
【单选题】下面列出的不等式中,正确的是(  )
A.
a不是负数,可表示成a>0
B.
x不大于3,可表示成x<3
C.
m与4的差是负数,可表示成m-4<0
D.
x与2的和是非负数,可表示成x+2>0
相关题目: