小玉家的电费

来源:互联网 发布:梵高 星空 知乎 编辑:程序博客网 时间:2024/06/10 08:07

题意

根据电价规定,计算出应交的电费应该是多少。


分析

简单的数学问题,看懂题目就会做。


var
s,t:real;
begin
    read(s);t:=0;
    if s<=150 then t:=s*0.4463 else
    if s<=400 then
    begin
        t:=150*0.4463;
        t:=t+(s-150)*0.4663;
    end else
    begin
        t:=150*0.4463;
        t:=t+(400-150)*0.4663;
        t:=t+(s-400)*0.5663;
    end;
    write(t:0:1);
end.

0 0