原题链接:https://leetcode-cn.com/problems/optimal-division/
class Solution {
public:
string optimalDivision(vector<int>& nums) {
int n = nums.size();
string res = "";
if (n == 1) return to_string(nums[0]);
if (n == 2) return to_string(nums[0]) + "/" + to_string(nums[1]);
for (int i = 0; i < n; ++i) {
res += to_string(nums[i]);
res += (i == n - 1) ? ")" : "/";
if (i == 0) res += "(";
}
return res;
}
};