roblem Statement A redundant storage system can survive a certain number of hard drive failures without losing any data. You are doing some analysis to determine the risk of various numbers of drives failing during one week. Your task is complicated by the fact that the drives in this system have different failure rates. You will be given a double[] containing n elements that describe the probability of each drive failing during a week. Return a double[] containing n + 1 elements, where element i is the probability that exactly i drives will fail during a week. Assume that drive failures are independent events. #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef vectorveci; typedef pair PII; #define ABS(x) ((x)>0?(x):-(x)) #define MIN(a,b) ((a)<(b)?(a):(b)) #define MAX(a,b) ((a)>(b)?(a):(b)) #define DPP 0.000000001 #define PI 3.1415926535897932 int gcd(int x,int y){if(y==0)return x;else return(gcd(y,x%y));} class DriveFailures { public: vector failureChances(vector fprob) { vectorprob(fprob.size()+1,0.0); int n=fprob.size(); int i,j; for(i=0;i<(1<>j)&1)==0) { f*=(1.0-fprob[j]); } else { c++; f*=fprob[j]; } } prob[c]+=f; } return prob; } };