# 期末考试题目

（1） 平均每小时应准备多少份点心？
（2） 每一批同时进店的顾客平均停留多长时间？

``````close all;
clear;
clc;
rand('state',sum(100*clock));

iter_num = 300;
snack_mean = zeros(iter_num,1);
staytime = zeros(iter_num,100);
staytime_mean = zeros(iter_num,1);

for iter = 1:iter_num
time = 0;
snack_num = 0;
count = 0;

count = count + 1;
pos = find(table2_cum>=rand);
cus_num = table2(pos(1),1);
for i = 1:cus_num
pos = find(table3_cum>=rand);
snack_num = snack_num + table3(pos(1),1);
end
staytime_tem = zeros(1,cus_num);
for i = 1:cus_num
pos = find(table4_cum>=rand);
staytime_tem(i) = table4(pos(1),1);
end
staytime(iter,count) = max(staytime_tem);

while time<=300
count = count + 1;
pos = find(table1_cum>=rand);
time = time + table1(pos(1),1);
pos = find(table2_cum>=rand);
cus_num = table2(pos(1),1);
for i = 1:cus_num
pos = find(table3_cum>=rand);
snack_num = snack_num + table3(pos(1),1);
end
staytime_tem = zeros(1,cus_num);
for i = 1:cus_num
pos = find(table4_cum>=rand);
staytime_tem(i) = table4(pos(1),1);
end
staytime(iter,count) = max(staytime_tem);
end
snack_mean(iter) = snack_num/5;
staytime_mean(iter) = sum(staytime(iter,:))/count;
end

mean1 = ceil(mean(snack_mean));
mean2 = round(mean(staytime_mean));
disp(['平均每小时应准备',num2str(mean1),'份点心']);
disp(['每批顾客平均停留时间为',num2str(mean2),'分钟']);

figure(1);
plot(1:iter_num,snack_mean,'-xb');hold on;
plot(1:iter_num,mean1*ones(1,iter_num),'-r','LineWidth',2);
xlabel('迭代次数');
ylabel('平均每小时吃的点心份数');
title('平均每小时吃的点心份数随迭代次数的变化');

figure(2);
plot(1:iter,staytime_mean,'-xb');hold on;
plot(1:iter,mean2*ones(1,iter_num),'-r','LineWidth',2);
xlabel('迭代次数');
ylabel('每批顾客平均停留时间');
title('每批顾客平均停留时间随迭代次数的变化');
``````

• 本文已收录于以下专栏：

## 期末考试之分等级

Problem Description 期末考试结束了，老师想要根据学生们的成绩划分出等级。共有5个等级A,B,C,D和E。 划分方法如下，90分（含90）以上的为A,80~90（含80）间的...

## 网络安全期末考试题目

1、OSI网络安全体系结构的五类安全服务和八类安全机制分别是什么？答：五大类安全服务(鉴别、访问控制、保密性、完整性、抗否认）八类安全机制(加密、数字签名、访问控制、数据完整性、鉴别交换、业务流填充、...

举报原因： 您举报文章：深度学习：神经网络中的前向传播和反向传播算法推导 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)