U E D R , A S I H C RSS

피보나치/임인택

def pibo(num):^M
        if num == 1 or num == 2 :^M
                return 1^M
        else:^M
                return pibo(num-1)+pibo(num-2)^M
^M
#using iteration w/o array (or anytype like array)^M
def piboIter(num):^M
    if num <= 2 :^M
        return 1^M
^M
    a = b = c = 1^M
    for i in range(0, num-2):^M
        c = a + b^M
        a = b^M
        b = c^M
    return c^M
^M
^M
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-05-27 07:09:19
Processing time 0.0110 sec