题解 | #牛牛的快递#

牛牛的快递

http://www.nowcoder.com/practice/41b42e7b3c3547e3acf8e90c41d98270

import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int price = 0;
        float weight = scanner.nextFloat();
        char ch = scanner.next().charAt(0);
        if((int) (weight * 10) % 10 == 0){
            price = 20 + ((int) weight - 1);
        }else{
            price = 20 + (int) weight;
        }
        if(ch == 'y'){
            price += 5;
        }
        System.out.print(price);
    }
}

全部评论

相关推荐

哇哇的菜鸡oc:他这不叫校招offer,而是实习offer
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务