|Submit||All submissions||Best solutions||Back to list|
TRI_SUMS - Sums in a triangle (challenge)
|Wersja polska||English version|
Let us consider a triangle of numbers in which a number appears in the first line, two numbers appear in the second line etc. Develop a program which will compute the largest of the sums of numbers that appear on the paths starting from the top towards the base, so that:
- on each path the next number is located on the row below, more precisely either directly below or below and one place to the right;
- the number of rows is strictly positive, but less than 101;
- all numbers are positive integers between 0 and 1002.
In the first line integer n - the number of test cases (less than 101). Then n test cases follow. Each test case starts with the number of lines which is followed by their content.
For each test case write the determined value in a separate line.
1 2 3
4 1 2
2 3 1 1
|Added by:||Piotr Ką kol|
|Cluster:||Cube (Intel G860)|
|Languages:||All except: NODEJS OBJC SCM qobi VB.NET|
|Resource:||Copy of Łukasz Kuszner's task SUMITR with different scoring|
2013-10-23 01:10:25 Piotr KÄ…kol
@Abhishek Gupta - Yes, for every task in this contest score is source length.
2013-10-18 11:46:07 Abhishek Gupta
@author: does the result implies bytes of code?
Last edit: 2013-10-18 11:54:53
2013-05-23 11:42:10 numerix
The judge seems to be broken: There is a 0 byte solution. Same for problem BINOMIAL.
[kuszi: Thank you for pointing this out, fixed]
Last edit: 2013-05-25 07:11:50
2010-05-02 10:02:49 Piotr KÄ…kol
You're right. I forgot to change input specification a bit. Thank You. :-)
2010-05-01 14:34:23 numerix
There seems something wrong with the input. My AC solution for SUMTRIAN/SUMITR gives NZEC here.
Edit 1: Pascal works, Python doesn't.
Edit 2: Problem identified and solved. Could be bad line ends or values > 99.
Last edit: 2010-05-01 14:45:27