题解 | #牛牛的快递#
牛牛的快递
https://www.nowcoder.com/practice/41b42e7b3c3547e3acf8e90c41d98270
public class Program { public static void Main() { string[] line = System.Console.ReadLine().Split(" "); double kg = double.Parse(line[0]); int price = 20; //如果价格大于1 if (kg > 1) { //如果不是整数 if (line[0].Length > 1) { string[] nums = line[0].Split("."); int leftNum = int.Parse(nums[0]); price += leftNum; } //如果是整数 else price+=int.Parse(line[0])-1; } if (line[1] == "y") price += 5; System.Console.WriteLine(price); } }