简单易懂,思维清晰,逻辑顺畅简易,OYeah!!!!!!! import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); float weight=in.nextFloat(); char ch=in.next().charAt(0); int money=20; if(weight<=1){ int addmoney=ch=='y'?5:0;//是否加急的钱 money+=addmoney; }else if(weight>1){ money+=Math.ceil(weight-1);//向上取整函数的使用,真好用!very good!! int addmoney=ch=='y'?5:0; money+=addmoney; } System.out.println(money); } }