wolves hace 3 meses
padre
commit
2a498251b6
Se han modificado 1 ficheros con 20 adiciones y 0 borrados
  1. 20 0
      25/12/3074.cpp

+ 20 - 0
25/12/3074.cpp

@@ -0,0 +1,20 @@
+#include <algorithm>
+#include <numeric>
+#include <vector>
+
+class Solution {
+public:
+    int minimumBoxes(std::vector<int>& apple, std::vector<int>& capacity) {
+        int sum = std::accumulate(apple.begin(),apple.end(),0);
+        std::sort(capacity.begin(),capacity.end(),[](int a,int b){return a>b;});
+        int ans = 0;
+        for(auto c : capacity){
+            sum -= c;
+            ans++;
+            if (sum <= 0) {
+                break;
+            }
+        }
+        return ans;;
+    }
+};

备用站点 当前处于降级运行的备用站点,仅供应急访问,数据和功能可能不是最新。