1 条题解

  • 0
    @ 2026-11-2 12:34:50

    小魔女帕琪(Little Witch Patchouli) 题解

    思路分析

    按题目要求使用对应数据结构与算法模拟/递推求解,注意数据范围边界与时间复杂度。

    参考代码

    #include <iomanip>
    #include <iostream>
    using namespace std;
    
    int main() {
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        long double a[7], s = 0;
        for (int i = 0; i < 7; ++i) {
            cin >> a[i];
            s += a[i];
        }
        if (s < 7) {
            cout << "0.000\n";
            return 0;
        }
        long double ans = 5040.0L * (s - 6.0L);
        for (int i = 0; i < 7; ++i) {
            ans = ans * a[i] / (s - i);
        }
        cout << fixed << setprecision(3) << (double)ans << "\n";
        return 0;
    }
    
    • 1

    信息

    ID
    8610
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者