题解 | #牛牛的快递#
牛牛的快递
https://www.nowcoder.com/practice/41b42e7b3c3547e3acf8e90c41d98270
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); float weight = sc.nextFloat(); char c = sc.next().charAt(0); int price = 0; if(weight <= 1){ price = 20; }else if(weight % 1 ==0){ price = 20 + (int)weight - 1; }else{ price = 20 + (int)weight ; } if(c == 'y'){ price += 5; } System.out.print(price); } }