Ken il y a 2 jours
Parent
commit
39e9bb9961
1 fichiers modifiés avec 14 ajouts et 2 suppressions
  1. 14 2
      app/Http/Controllers/api/Home.php

+ 14 - 2
app/Http/Controllers/api/Home.php

@@ -120,14 +120,26 @@ class Home extends Controller
 //        $target = 27;
         $target =  request()->input('a',15);
         $target= intval($target);
-        echo $target;
-        echo "<br/>";
+
+
         $matchingNumbers = $this->getMatchingNumbers($target);
         if ($matchingNumbers !== null) {
             echo "找到的数字是:" . implode(", ", $matchingNumbers);
         } else {
             echo "未找到匹配的数字组合。";
         }
+        echo "<br/>";
+        echo $target;
+        echo "<br/>";
+        $sum = 0;
+        for ($i =2;$i<19;$i++) {
+            echo $matchingNumbers[$i];
+            $sum+= $matchingNumbers[$i];
+            echo " + ";
+
+        }
+        echo " = ".$sum;
+        echo "<br/>";
 
 exit();