#include #include using namespace std; // The number of tickets purchased by each student for the University // X vs. University Y football game follows a distribution that has a // mean of mu = 2.4 and a standard deviation of sigma = 2.0. // A few hours before the game starts, 100 eager students line up to // purchase last-minute tickets. If there are only 250 tickets left, // what is the probability that all students will be able to purchase // tickets? // mu' (mean) = n * mu // sigma' (stddev) = sqrt(n) * sigma int main() { int n = 100 /* students */; int mean = n * 2.4 /* tickets */; // mu int stddev = sqrt(n) * 2.0 /* tickets */; // sigma // Probability P(X <= x) auto normalCDF = [](double x, double mean, double stddev) { double val = (x - mean)/(stddev * sqrt(2)); return 0.5 * (1 + (erf(val))); }; double answer_1 = normalCDF(250 /* tickets */, mean, stddev); cout << fixed << setprecision(4) << answer_1 << endl; }