1. Куча / Говнокод #10554

    +127

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    # My first attempt in J:
    +/(>/)"1 <.@(10&^.)(2 & x:) (+%)/\(1x,1000$2)
    
    # It gave the right answer, but took about an hour.
    # Based on other people's comments I went back and figured out the relationship
    # between one answer and the next, and came up with this,
    # which runs in less than 1 second:
    ((((0{])+([:$[:":1{])>([:$[:":2{])),(1{]+2*2{]),1{]+2{])^:1000) 0 3x 2x

    http://projecteuler.net/thread=57;page=2


    Как на этом можно писать?

    Запостил: TheHamstertamer, 04 Июня 2012

    Комментарии (19) RSS

    Добавить комментарий