class Solution {
public:/***@param L: Given n pieces of wood with length L[i]*@param k: An integer*return: The maximum length of the small pieces.*/int woodCut(vector<int> L, int k){if(L.empty()) return 0;LL low=0, high=*max_element(L.begin(), L.end());while(low<high){if(low+1==high){LL ans=0;for(auto e: L){ans+=e/high;}if(ans>=k) return high;else return low;}LL mid=(low+high)/2;LL ans=0;for(auto e: L){ans+=e/mid;}if(ans>=k) low=mid;else high=mid-1;}return low;}
}S;