Sort by

recency

|

79 Discussions

|

  • + 0 comments
    from math import exp,factorial
    
    def thnks_for_the_fish(machine, cost):
        return sum((exp(-machine) * machine**k) / factorial(k) * (cost + 40 * k**2) for k in range(20))
    
    A,B = map(float,input().split(" "))
    
    print(round(thnks_for_the_fish(A, 160), 3))
    print(round(thnks_for_the_fish(B, 128), 3))
    
  • + 0 comments

    In R could be:

    stdin <- file('stdin')
    open(stdin)
    
    line <- as.numeric(strsplit(trimws(readLines(stdin, n = 1, warn = FALSE), which = "right"), " ")[[1]])
    cat(format(round(160 + 40*(line[1]+line[1]^2),3), nsmall=3), fill=TRUE)
    cat(format(round(128 + 40*(line[2]+line[2]^2),3), nsmall=3), fill=TRUE)
    
  • + 1 comment
    X,Y=map(float,input().split())
    print(round(160+(40*(X+X**2)),3))
    print(round(128+(40*(Y+Y**2)),3))
    
  • + 0 comments
    print(160 + 40*(0.88+0.88**2))
    print(128 + 40*(1.55+1.55**2))
    
  • + 0 comments

    JS

       let value = input.split(" ");
        let ca = 160 + (40 * (Math.pow(parseFloat(value[0]), 2) + parseFloat(value[0])));
        let cb = 128 + (40 * (Math.pow(parseFloat(value[1]), 2) + parseFloat(value[1])));
        console.log(ca.toFixed(3), "\n" , cb.toFixed(3));