![]() |
![]() |
#1 |
"Mike"
Aug 2002
79·101 Posts |
![]() |
![]() |
![]() |
![]() |
#2 |
Jun 2003
23×607 Posts |
![]() Code:
cost=vector(100); choice=vector(100);
cost[1]=0; choice[1]=1;
for(i=2,100, mcost=10000; mchoice=0; for(ch=1,i-1, ncost=(ch/i)*(1+cost[ch])+((i-ch)/i)*(10+cost[i-ch]); if(ncost < mcost, mcost=ncost; mchoice=ch)); cost[i]=mcost; choice[i]=mchoice)
Last fiddled with by axn on 2014-08-09 at 16:52 |
![]() |
![]() |
![]() |
#3 |
"Mike"
Aug 2002
174538 Posts |
![]() |
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
August 2017 | Batalov | Puzzles | 15 | 2017-09-05 03:47 |
August 2015 | R. Gerbicz | Puzzles | 7 | 2015-09-04 13:18 |
2801^79-1 reservations (CLOSED 27 AUGUST) | fivemack | Factoring | 76 | 2010-11-06 11:36 |
August Progress | Wacky | NFSNET Discussion | 0 | 2007-08-09 02:32 |
SIRTF launches August 25! | dswanson | Lounge | 10 | 2003-08-27 22:48 |