蓝桥杯 试题 算法训练——猴子吃包子

    科技2022-08-14  88


    题解

    后台数据只有两位小数。。。记录一下格式化写法

    AC-Code

    //#include <bits/stdc++.h> #include <iostream> #include <vector> #include <algorithm> #include <queue> #include <string.h> #include <iomanip> using namespace std; typedef long long ll; #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); const int maxn = 1e3 + 5; const int maxm = 1e4 + 5; const int mod = 1e9 + 7; const int inf = 0x3f3f3f3f; int main() { long double x, y, z, x1, y1, z1, p; while (cin >> x >> y >> z >> x1 >> y1 >> z1 >> p) { cout << setiosflags(ios::fixed) << setprecision(p) << (x1 * y * z + y1 * x * z + z1 * x * y) / (x * y * z) << endl; } }
    Processed: 0.009, SQL: 8