<\/span><\/h2>\n\n\n\nIn this challenge, we practice solving problems based on the Central Limit Theorem<\/em>.<\/p>\n\n\n\n<\/span>Task<\/strong><\/span><\/h2>\n\n\n\nA large elevator can transport a maximum of 9800<\/strong> pounds. Suppose a load of cargo containing 49<\/strong> boxes must be transported via the elevator. The box weight of this type of cargo follows a distribution with a mean of u<\/em> = 205<\/strong> pounds and a standard deviation of o<\/em> = 15<\/strong> pounds. Based on this information, what is the probability that all 49<\/strong> boxes can be safely loaded into the freight elevator and transported?<\/p>\n\n\n\n<\/span>Input Format<\/strong><\/span><\/h2>\n\n\n\nThere are 4<\/strong> lines of input (shown below):<\/p>\n\n\n\n9800\n49\n205\n15<\/code><\/pre>\n\n\n\nThe first line contains the maximum weight the elevator can transport. The second line contains the number of boxes in the cargo. The third line contains the mean weight of a cargo box, and the fourth line contains its standard deviation.<\/p>\n\n\n\n
If you do not wish to read this information from stdin, you can hard-code it into your program.<\/p>\n\n\n\n
<\/span>Output Format<\/strong><\/span><\/h2>\n\n\n\nPrint the probability that the elevator can successfully transport all 49<\/strong> boxes, rounded to a scale of 4<\/strong> decimal places (i.e., 1.2345<\/strong> format).<\/p>\n\n\n\n<\/span>Solution – The Central Limit Theorem I<\/strong><\/span><\/h2>\n\n\n\n<\/span>C++<\/strong><\/span><\/h3>\n\n\n\n#include <cmath>\n#include <cstdio>\n#include <vector>\n#include <iostream>\n#include <algorithm>\nusing namespace std;\n\ndouble normal_dist(double m, double sd, double x)\n{ \n \/*\n p = 1\/2*(1 + erf((x - m)\/(sd*sqrt(2))));\n *\/\n \n double p = 0.5*(1 + erf((x-m)\/(sd*sqrt(2.0))));\n return p; \n}\n\nint main() {\n \/* Enter your code here. Read input from STDIN. Print output to STDOUT *\/ \n \n double m = 49*205, sd = sqrt(49)*15, x = 9800;\n \n printf(\"%0.4f\", normal_dist(m, sd, x));\n \n return 0;\n}<\/pre>\n\n\n\n