HackerRank Day 5: Poisson Distribution II | 10 Days of Statistics solution YASH PAL, 31 July 2024 In this Hackerrank Day 5: Poisson Distribution II 10 Days of Statistics problem a manager of an industrial plant is planning to buy a machine of either A or type B. on the first line we need to print the expected daily cost of machine A and on the second line, we need to print the expected daily cost of machine B. Problem solution in Python programming. # Enter your code here. Read input from STDIN. Print output to STDOUT # Input from stdin averageX, averageY = [float(num) for num in input().split(" ")] # Cost CostX = 160 + 40*(averageX + averageX**2) CostY = 128 + 40*(averageY + averageY**2) print(round(CostX, 3)) print(round(CostY, 3)) Problem solution in Java Programming. import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner scan=new Scanner(System.in); double XA=scan.nextDouble(); double XB=scan.nextDouble(); System.out.format("%.3f%n%.3f",160+40*(XA+XA*XA),128+40*(XB+XB*XB)); } } Problem solution in C++ programming. #include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ double dMeanA = 0; double dMeanB = 0; cin >> dMeanA >> dMeanB; double dExpectedA = dMeanA + pow(dMeanA,2); double dExpectedB = dMeanB + pow(dMeanB,2); double dCostA = 160 + 40 * dExpectedA; double dCostB = 128 + 40 * dExpectedB; printf("%.3fn", dCostA); printf("%.3fn", dCostB); return 0; } Problem solution in C programming. #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ double mean1 = 0.88; double mean2 = 1.55; printf("%.3fn", (double) (160 + 40 * (mean1 + (mean1 * mean1)))); printf("%.3fn", (double) (128 + 40 * (mean2 + (mean2 * mean2)))); return 0; } Problem solution in JavaScript programming. function processData(input) { //Enter your code here console.log((160 + (40*(Math.pow(0.88, 2) + 0.88))).toFixed(3)); console.log((128 + (40*(Math.pow(1.55, 2) + 1.55))).toFixed(3)); } process.stdin.resume(); process.stdin.setEncoding("ascii"); _input = ""; process.stdin.on("data", function (input) { _input += input; }); process.stdin.on("end", function () { processData(_input); }); 10 days of statistics coding problems