Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #53959

Project Euler 67.

From "Robert L." <No_spamming@noWhere_7073.org>
Newsgroups comp.lang.forth
Subject Project Euler 67.
Date 2017-01-12 15:46 +0000
Organization Aioe.org NNTP Server
Message-ID <o588c5$2p7$1@gioia.aioe.org> (permalink)

Show all headers | View raw


There are only two differences from problem 18.:

1. The triangle has to be obtained from a text file.
2. There are 100 rows in the triangle.

The website says that if you could check 10^12 routes every second,
it would take you over 20 billion years to check them all.


Ruby:

triangle = IO.readlines("p067_triangle.txt").
  map{|line| line.scan( /\d+/ ).map &:to_i}

until triangle.one?
  row1, row2 = triangle.pop(2)
  triangle.push row1.map.with_index{|n,i| n + [row2[i],row2[i+1]].max}
end
triangle.pop.pop

    ===>
7273

In Forth?

-- 
In his message [the Jew Nicolas] Sarkozy insisted that the French people must
change, that there will be dire consequences if they don't, and that not to
intermarry racially is bad for the survival of the country.
archive.org/download/DavidDuke_videos/StopTheGenocideOfEuropeanMankindDavidDuke-z43pcbr_el0.ogv

Back to comp.lang.forth | Previous | Next | Find similar | Unroll thread


Thread

Project Euler 67. "Robert L." <No_spamming@noWhere_7073.org> - 2017-01-12 15:46 +0000

csiph-web