1某自行车商店的仓库管理人员采取一种简单的订货策略:当库存量降低到P辆自行车时就向厂家订货,每次订货Q辆,每次订货费75元,3天后到货。每辆自行车的保管费为0.75元/天,缺货损失为1.80元/天。自行车每天的需求量服从0到99之间的均匀分布,原始库存为115辆,假设第一天没有发出订货。 现有如下五种订货策略,试以150天进行仿真测试,选择一个使总费用最小的订货策略。
策略 P Q
1 125 150
2 125 250
3 150 250
4 175 250
5 175 300
https://download.csdn.net/download/willow_wgx/3044131
https://blog.csdn.net/weixin_39632379/article/details/119099242
#include <stdio.h>
int main(void)
{
double first[8], second[8];
int i;
for(i=0; i<8; i++)
{
scanf("%lf",&first[i]);
if(i>0)
{
second[i] = first[i]+second[i-1];
}else{
second[i] = first[i];
}
}
for(i=0; i<8; i++)
{
printf("%.2lf ",second[i]);
}
return 0;
}
运行结果: