Page 1 of 1

11161 - Help My Brother (II)

Posted: Sat Mar 03, 2007 4:44 am
by guma
I've just got AC after solving some problems with TL, as I've search here for something about this problem that could help and didn't find anything I'll just post the things that I found useful and some I/O.
My solution is simple. Calculate all the numbers first the just get the results in the array. The biggest problem, that isn't that big, is the operations with bigint that you have to do. But is realy simple, just think a little bit and you will do it :P
The trick for me was to go adding the fibonacci numbers every line. If I tell you more I think I would be giving away the fun :P

Some I/O:
Input:

Code: Select all

10
14
155
180
400
555
666
999
1487
1500
0
Output:

Code: Select all

Set 1:
115
Set 2:
797
Set 3:
234170488363228576876271664997963
Set 4:
39284675299699447013625736408529343759
Set 5:
372824138430996594992102410377666621000572280434550986929840192094256943926140333737
Set 6:
92169718619701003782319770045546108450450839285244369607488941121160705677469510715184663277347733796505032365147250
Set 7:
14528351190467150807702590231882807079803347311728304088075256318069747026795021188958361865075047076177726597653754998423273012478567815295
Set 8:
56898462699180136128761891276112087786372965176865256572543317088345546268072992735073064667320933451391836521161044312931698026444345048484788586848185281090200263524748554511527057385697284020020206086316186
Set 9:
55089518261398163975838664581483953086011866482985985679559024533414973977774965658844111158006871514344112047785999650435945186419211534881572558790235640577618161315220943087602825896562512194788378985910567308081666206228883415696547508131342714671309471911448949753280972053987240178511874936563978094363471
Set 10:
28701744751837792382504572139884120147379967713887071940676339260022480759432919082091100482233546321172088309232288923831292573813121811949336397234056265575500939047400236820195426898258659064631250334361870821632035980332554329588700990727932911111805509586445564570998035498070885814859763360107757327357397999
I hope it helps someone somehow.

8)

Posted: Sat Mar 03, 2007 9:59 am
by sclo
I never needed to add any fibonacci number, I found a recursion for the first number of each row. And it would be easy to find the median from that.
It runs in 0.086s even without precomputing a table.

Re: 11161 - Help My Brother (II)

Posted: Thu Mar 13, 2014 3:30 pm
by uDebug
Replying to follow the thread.