标签:+= als pen ack map bool stream blank color
假算法过题
#include<iostream> #include<cstdio> #include<vector> #include<algorithm> #include<cstring> #include<string> #include<map> #include<set> #include<queue> #include<iomanip> #include<stack> using namespace std; #define STDIN freopen("in.in", "r", stdin);freopen("out.out", "w", stdout); const int N = 1e5 + 10; int n; double z, r; double v[N]; double v1[N]; int main() { STDIN cin >> n >> z >> r; v[0] = z; double sum = 0; double sum2 = 0; bool flag = false; for (int i = 0; i < n; i++) { int x; cin >> x; if (x == 0) { double t; cin >> t; sum += v[i]*(t);sum2 += v[i]*(t+1); v[i] = v[i]*(t);v1[i] = v1[i]*(t+1); if (v[i] == 0) flag = true; // cout << i << " " <<v[i] << endl; } else for (int j = 1; j <= x; j++) { int t; cin >> t; v[t] = v[i]*(1-r*0.01); v1[t] = v1[i]*(1-r*0.01); } } if (flag) printf("%lld\n", (long long)sum2); else printf("%lld\n", (long long)sum); }
标签:+= als pen ack map bool stream blank color
原文地址:https://www.cnblogs.com/hulian425/p/14039924.html