2 条题解

  • 0
    @ 2025-9-13 11:03:39
    #include <bits/stdc++.h>
    using namespace std;
    
    int main() {
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    
        // 难度比例表
        unordered_map<int, double> ratio = {
            {2, 0.4}, {3, 0.5}, {4, 0.6},
            {6, 0.7}, {7, 0.8}, {9, 0.9}, {10, 1.0}
        };
    
        int T;
        cin >> T;
        while (T--) {
            int m;
            cin >> m;
            double total = 0.0;
            for (int i = 0; i < m; i++) {
                char op;
                cin >> op;
                if (op == 'A') {
                    int x;
                    cin >> x;
                    if (x >= 1 && x <= 10) total += x;
                    else total += (x % 10) * 10;
                } 
                else if (op == 'B') {
                    int n, c;
                    cin >> n >> c;
                    total += ratio[n] * 50 * c * 0.1;
                } 
                else if (op == 'C') {
                    int n, c;
                    cin >> n >> c;
                    total += ratio[n] * 20 * c * 0.01;
                }
            }
            cout << fixed << setprecision(2) << total << "\n";
        }
        return 0;
    }
    

    信息

    ID
    1665
    时间
    1000ms
    内存
    256MiB
    难度
    10
    标签
    递交数
    29
    已通过
    3
    上传者