//题解:
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner console = new Scanner(System.in);
        int price = console.nextInt();
        int cost = 0;

        //write your code here......
        //从大到小顺序列出:
    if(price>=5000) cost = (int) (price*0.6);
    else if(price>=2000) cost = (int) (price*0.7);
    else if(price>=500) cost = (int) (price*0.8);
    else if(price>=100) cost = (int) (price*0.9);
    else cost=price;
        
    System.out.println(cost);

    }
}

计算商场折扣_牛客题霸_牛客网 (nowcoder.com)icon-default.png?t=M276https://www.nowcoder.com/practice/cf4dcda7bf974f83afe38af4b14946a7

描述

牛牛商场促销活动:

满100全额打9折;

满500全额打8折;

满2000全额打7折;

满5000全额打6折;

且商场有抹零活动,不足一元的部分不需要付款(类型强制转换)

牛大姨算不清楚自己应该付多少钱,请你帮忙算一下

输入描述:

牛大姨账单钱数(int类型)

输出描述:

参加活动后,牛大姨应付钱数(int类型)

示例1

输入:

654

输出:

523
Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐