2591. 将钱分给最多的儿童 - 力扣(LeetCode)
class Solution {
public:
int distMoney(int money, int children) {
if(money<children)return -1;
else {
int count=0;
money-=children;
if(money>=7){
count+=min(money/7,children);
money-=count*7;
children-=count;
}
if(children==0&&money>0)count--;
else if(children==1&&money==3)count--;
return count;
}
}
};