Java实现 洛谷 P1422 小玉家的电费
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner (System.in);
int ele = in.nextInt();
double out;
if (ele <= 150)
{
out = 0.4463*ele;
}
else if ((150 < ele) && (ele <= 400))
{
out = 66.945 + 0.4663 * (ele - 150);
}
else
{
out = 150*0.4463 + 250*0.4663 + (ele - 400)*0.5663;
}
System.out.println(String.format("%.1f", out));
}
}