#include <stdio.h>
#include <string.h>

int main() {
    char member[10];  // 会员等级（普通/银卡/金卡）
    float amount;     // 消费金额
    char is_sale;     // 是否购买特价商品（y/n）
    float pay;        // 实际支付金额

    // 输入信息
    printf("请输入会员等级（普通/银卡/金卡）：");
    scanf("%s", member);
    printf("请输入消费金额（元）：");
    scanf("%f", &amount);
    printf("是否购买特价商品（y/n）：");
    scanf(" %c", &is_sale);  // 空格跳过前序回车

    // 计算实际支付金额
    if (is_sale == 'y' || is_sale == 'Y') {
        // 购买特价商品：仅会员基础折扣
        if (strcmp(member, "普通") == 0) {
            pay = amount;  // 无折扣
        } else if (strcmp(member, "银卡") == 0) {
            pay = amount * 0.9;  // 9折
        } else if (strcmp(member, "金卡") == 0) {
            pay = amount * 0.8;  // 8折
        } else {
            printf("会员等级输入错误！\n");
            return 0;  // 退出程序
        }
    } else if (is_sale == 'n' || is_sale == 'N') {
        // 未购买特价商品：先算会员折扣，再叠加满减
        float discount_amount;  // 折扣后金额

        // 计算会员折扣后金额
        if (strcmp(member, "普通") == 0) {
            discount_amount = amount;
        } else if (strcmp(member, "银卡") == 0) {
            discount_amount = amount * 0.9;
        } else if (strcmp(member, "金卡") == 0) {
            discount_amount = amount * 0.8;
        } else {
            printf("会员等级输入错误！\n");
            return 0;
        }

        // 计算满减（仅最高一档）
        if (discount_amount >= 1000) {
            pay = discount_amount - 150;
        } else if (discount_amount >= 500) {
            pay = discount_amount - 60;
        } else if (discount_amount >= 300) {
            pay = discount_amount - 30;
        } else {
            pay = discount_amount;  // 不满足满减条件
        }
    } else {
        printf("是否购买特价商品输入错误！\n");
        return 0;
    }

    // 输出结果（保留两位小数）
    printf("实际支付金额：%.2f元\n", pay);
    return 0;
}
