Skip to content
Snippets Groups Projects
Commit 328633d3 authored by Martin's avatar Martin
Browse files

P2 done

parent 196ab076
No related branches found
No related tags found
No related merge requests found
...@@ -29,9 +29,3 @@ class BinPack: ...@@ -29,9 +29,3 @@ class BinPack:
def afficherBinPack(self): def afficherBinPack(self):
print(f" Nombre d'objets = {self.nbObjet}, Nombre de sac {self.nombreDeSac}, Capaciter d'un sac " print(f" Nombre d'objets = {self.nbObjet}, Nombre de sac {self.nombreDeSac}, Capaciter d'un sac "
f"{self.capaciterDunSac}\n Poid des objets : {self.poidsDesObjets}\n") f"{self.capaciterDunSac}\n Poid des objets : {self.poidsDesObjets}\n")
def getNbObj(self):
return self.nbObjet
def getCapaciter(self):
return self.capaciterDunSac
...@@ -16,9 +16,9 @@ class Sum: ...@@ -16,9 +16,9 @@ class Sum:
all = file.readlines() all = file.readlines()
n = int(all[0]) n = int(all[0])
lsent = [] lsent = []
for i in range(n - 1): for i in range(n):
lsent.append(int(all[i + 1])) lsent.append(int(all[i + 1]))
c = int(all[n - 1]) self.cible = int(all[n + 1])
self.nbEntier = n self.nbEntier = n
self.listeEntiers = lsent self.listeEntiers = lsent
...@@ -27,4 +27,5 @@ class Sum: ...@@ -27,4 +27,5 @@ class Sum:
f"{self.listeEntiers} ") f"{self.listeEntiers} ")
def reduceToPartition(self) -> Partition: def reduceToPartition(self) -> Partition:
return Partition(self.nbEntier + 1, self.listeEntiers.append(self.cible)) ls = self.listeEntiers + [self.cible]
return Partition(self.nbEntier + 1, ls)
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment