auto optimize_cpp_stdio = []() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr); return0; }(); classSolution { public: conststaticint maxn = 1e5 + 10; conststaticint maxm = 1e5 + 10; constint INF = 0x3f3f3f3f; intnumSubarrayProductLessThanK(vector<int> &nums, int k) { int l = 0, r = 0; int ans = 0; longlong mul = 1; int n = nums.size(); for (r = 0; r < n; ++r) { mul *= nums[r]; while (l <= r && mul >= k) { mul /= nums[l]; ++l; } ans += (r - l + 1); } return ans; } };