Path: csiph.com!aioe.org!LHWy7XmJ85FbA297tJcizg.user.gioia.aioe.org.POSTED!not-for-mail From: Dominique Newsgroups: fr.comp.lang.python Subject: =?UTF-8?B?UmU6IFNvbW1lLCByw6ljdXJzaXZl?= Date: Sat, 1 May 2021 04:39:13 +0200 Organization: Aioe.org NNTP Server Lines: 41 Message-ID: References: <48-dnbOA4f2klhb9nZ2dnUU7983NnZ2d@giganews.com> <608c003f$0$32507$426a74cc@news.free.fr> <608c6324$0$3713$426a74cc@news.free.fr> NNTP-Posting-Host: LHWy7XmJ85FbA297tJcizg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 Content-Language: fr X-Notice: Filtered by postfilter v. 0.9.2 Xref: csiph.com fr.comp.lang.python:3498 Le 30/04/2021 à 22:05, debimax a écrit : > Bonsoir dominique Bonjour Jean-Claude, > > https://fr.wikipedia.org/wiki/Programmation_dynamique?Pyramide%20de%20nombres#Pyramide_de_nombres Merci pour ce lien. C'est un niveau mathématique qui dépasse largement le mien. > > > ce qui fait un truc comme ça > > ```python > p=[[3],[2,4],[2,7,5],[9,5,4,6]] > > > def sommeMaxR(p,i=0,j=0): > assert 0<=j<=i, 'Attention j doit être inférieur à i' > if i==len(p)-1: > return p[i][j] > else: > return p[i][j]+max(sommeMaxR(p,i+1,j), sommeMaxR(p,i+1,j+1)) > sommeMaxR(p) Dès que je suis dans le TGV (dans 1 semaine), je dépouille ton script ligne à ligne. Je comprendrai mieux. Bien à toi, -- Dominique Courriel : dominique point sextant ate orange en France Esto quod es