Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

定員100で男子800人女子200人が受験して合格率の男女比1.2

choose n r = product[1..n] `div` product[1..n-r] `div` product[1..r]
ratio=1.2
pass=100
man=800
woman=200
total=man+woman
ii=[0..pass]
male_fem i=    if  r < ratio then 0 else p
        where   m=fromIntegral i/ fromIntegral man
                w=fromIntegral (pass-i)/fromIntegral woman
                r = m/w
                a = (choose man i)*(choose woman (pass-i))
                b = choose total pass
                p = (fromIntegral a) / (fromIntegral b)

main = do
    print $ sum ( map male_fem ii)

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.