• + 1 comment

    A variation of this using the cmp built-in function

    n = int(raw_input().strip())
    arr = map(int,raw_input().strip().split(' '))
    
    NEG, EQUAL, POS = -1, 0, +1
    
    D = {NEG : 0, EQUAL: 0, POS: 0}
    
    for i in arr:
        D[cmp(i, 0)] += 1
    
    for k in (POS, NEG, EQUAL):
        f = 1.0 * D[k] / n
        print "%.6f" % f