diff --git a/.idea/misc.xml b/.idea/misc.xml
index 1b2d69351e8b58384566aba7da83f9e6f7d7b030..38eefb8d41bfcaa3b3c8cc6ce120644e508e2a6e 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_22" default="true" project-jdk-name="22" project-jdk-type="JavaSDK">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="18" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/out" />
   </component>
 </project>
\ No newline at end of file
diff --git a/out/production/aroTP2/App.class b/out/production/aroTP2/App.class
index 8d3c8e862e7d1d8ac1daac52964bbb7ec3329713..4ae707af27c19bbfc1bf784eb39242b2b1eb1ffe 100644
Binary files a/out/production/aroTP2/App.class and b/out/production/aroTP2/App.class differ
diff --git a/out/production/aroTP2/InstanceReader.class b/out/production/aroTP2/InstanceReader.class
index 9a1d5b11a0914dac9a5b1a1a0bdda4d0958bdced..5e8faaeb63c791acfcbc457ec4e45f20eb8b6eee 100644
Binary files a/out/production/aroTP2/InstanceReader.class and b/out/production/aroTP2/InstanceReader.class differ
diff --git a/out/production/aroTP2/Loot.class b/out/production/aroTP2/Loot.class
index 4ffba3f58d9594f16f64fe6527d3748ef90eb0fc..dcc24c07e6b496357fea863d1d9cdfe408d4b69a 100644
Binary files a/out/production/aroTP2/Loot.class and b/out/production/aroTP2/Loot.class differ
diff --git a/src/Backpack.java b/src/Backpack.java
index b8552f0f0bf5768429ce28456da51acb4081337e..c1b83218929edff63d23363e88d7a2a4c658ee55 100644
--- a/src/Backpack.java
+++ b/src/Backpack.java
@@ -27,13 +27,16 @@ public class Backpack {
         this.sortByRatio();
 
         for(Loot loot : loots){
-            if(loot.getWeight() > this.capacity){
-                sfValuee += (loot.getValue() * loot.getWeight()) / (capacity - sfWeight);
-                sfWeight += capacity - sfWeight;
+            if(sfWeight + loot.getWeight() <= this.capacity){
+                // Si l'objet entier peut entrer dans le sac
+                sfValuee += loot.getValue();
+                sfWeight += loot.getWeight();
             }
             else {
-                sfValuee += loot.getWeight();
-                sfWeight += loot.getWeight();
+                // Si l'objet ne peut pas entrer entièrement dans le sac
+                int remainingWeight = this.capacity - sfWeight;
+                sfValuee += (int) (loot.getRatio() * remainingWeight);
+                break;
             }
         }
     }
diff --git a/src/Loot.java b/src/Loot.java
index e2a85e00913b0890cf5461e66d69589ac99a4cce..d7dc0320d837cc34d2d2fbda4f41e65e6c8f3e3c 100644
--- a/src/Loot.java
+++ b/src/Loot.java
@@ -5,7 +5,7 @@ public class Loot {
     public Loot(int weight, int value) {
         this.weight = weight;
         this.value = value;
-        this.ratio = (float) weight/value;
+        this.ratio = (float) value/weight;
     }
 
     public String toString(){