fonction 4 : O(n + J)

This commit is contained in:
abraham
2026-10-21 11:19:08 +02:00
parent df4e8876fb
commit 1e3ac9d8d2
3 changed files with 20 additions and 4 deletions
+3 -3
View File
@@ -118,10 +118,10 @@ void total_par_jour(const Transaction *t, int n, long *totaux)
{
for (int j = 0; j < NB_JOURS; j++) {
totaux[j] = 0;
for (int i = 0; i < n; i++)
if (t[i].jour == j)
totaux[j] += t[i].montant;
}
for (int i = 0; i < n; i++)
totaux[t[i].jour] += t[i].montant;
}
/* F5 : période de jours consécutifs dont la somme des soldes est maximale */