#45755: 小蜜蜂之暴力解


1121226@stu.wghs.tp.edu.tw (Arthur✨小蜜蜂)

學校 : 臺北市私立薇閣高級中學
編號 : 252772
來源 : [60.248.154.143]
最後登入時間 :
2025-04-09 15:55:05
f147. 1. 點餐系統 (Ordering System) -- 2020年6月TOI練習賽新手組 | From: [60.248.154.139] | 發表日期 : 2025-04-08 12:58

#include <bits/stdc++.h>
using namespace std;
int main() {
    int cmd;  // 使用者指令
    int total = 0;  // 總金額
    while(cin >> cmd) {
        if(cmd == 0) {  // 結帳
            cout << "Total: " << total << endl;
            break;
        }
        int choice;  // 選擇的餐點編號
        cin >> choice;
        if(cmd == 1) {  // 套餐
            if(choice == 1) {
                cout << "Medium Wac 4" << endl;
                total += 4;
            }
            else if(choice == 2) {
                cout << "WChicken Nugget 8" << endl;
                total += 8;
            }
            else if(choice == 3) {
                cout << "Geez Burger 7" << endl;
                total += 7;
            }
            else if(choice == 4) {
                cout << "ButtMilk Crispy Chicken 6" << endl;
                total += 6;
            }
            else if(choice == 5){
                cout << "Plastic Toy 3" << endl;
                total += 3;
            }
        }
        else if(cmd == 2) {  // 單點
            if(choice == 1) {
                cout << "German Fries 2" << endl;
                total += 2;
            }
            else if(choice == 2) {
                cout << "Durian Slices 3" << endl;
                total += 3;
            }
            else if(choice == 3) {
                cout << "WcFurry 5" << endl;
                total += 5;
            }
            else if(choice == 4) {
                cout << "Chocolate Sunday 7" << endl;
                total += 7;
            }
            else if(choice == 5) {
                cout << "Plastic Toy 3" << endl;
                total += 3;
            }
        }
    }

    return 0;
}
 
ZeroJudge Forum