Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- using ll = long long;
- using ld = long double;
- int main()
- {
- cout << setprecision(7);
- cout << fixed;
- vector<ld> z1;
- ld t, ts;
- cin >> t;
- ts = t;
- ld a;
- while (t-- > 0)
- {
- cin >> a;
- z1.push_back(a);
- }
- ld s = 0;
- s = z1.at(0);
- ld u = 4.0, d = 5.0;
- for (int i = 1; i < ts; i++)
- {
- s += z1.at(i) * (u / d);
- u *= 4.0;
- d *= 5.0;
- }
- s = s / 5.0;
- cout << s << '\n';
- ld v, sf = 0;
- for (int i = 0; i < ts; i++)
- {
- u = 4.0;
- d = 5.0;
- for (int p = 0; p < ts; p++)
- {
- if (p != i)
- {
- s = z1.at(p);
- v = p;
- break;
- }
- }
- for (int w = 0; w < ts; w++)
- {
- if (w != i && w != v)
- {
- s += z1.at(w) * (u / d);
- u *= 4.0;
- d *= 5.0;
- }
- }
- sf += s;
- }
- sf = sf / ts;
- sf = sf / 5;
- cout << sf << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment