Auto commit

This commit is contained in:
2025-03-28 08:06:46 +08:00
parent 195f784173
commit d06b6fc13d
2 changed files with 27 additions and 9 deletions
+11 -6
View File
@@ -39,11 +39,16 @@ int calculateDeliveryTimes(int weights[], int size) {
int deliveryTimes = 1;
/**********Program**********/
int i;
for(i=0;i<size;i++){
if(weights[i] <= 50){
if(currentWeight + weights[i] > 50){
currentWeight=0;
deliveryTimes++;
}
currentWeight += weights[i];
}
}
/********** End **********/
return deliveryTimes;
}
@@ -67,4 +72,4 @@ int main() {
printf("需要%d次才能将所有包裹配送完毕。\n", times);
return 0;
}
}