- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
<分区>
指向我的 PasteBin 的链接:
http://pastebin.com/nzW3hZdT
I'm in the process of simulating a fast food restaurant over three hours. The three hours are divided into 18 intervals, consisting of 10 minutes each.
Based off an arrival rate of 'r' customers per minute, 'R' is established. R is the arrival rate, by probability, for all 18 intervals (which is more or less r/60).
The purpose of this simulation is to define 'r' ourselves and see the average waiting time (avgWait) of each customer in all 18 intervals. Generally, the greater the 'r', the greater the 'avgWait'.
此时在我的代码中(粘贴在上面),平均等待时间正确打印......对于一位客户。
假设第一位和第二位顾客分别在收银台 1 和收银台 2 接受订单大约需要 85 秒。在这 85 秒内,很有可能有更多的顾客到达,但是因为 cash1empty=FALSE
和 cash2empty=FALSE
他们显然无法接受他们的订单。
我如何设置这个队列,以便程序知道在前两个订单得到服务后还有几个其他人在等待服务?
代码摘录:
if ((cash1empty==TRUE)&&(cash2empty==TRUE))
{
switch((rand()%2))
{
case 0:
cash1empty=FALSE;
break;
case 1:
cash2empty=FALSE;
break;
}
}
if (cash1empty==TRUE)
{
cash1empty=FALSE;
switch((rand()%2))
{
case 0:
cash1salad=(rand()%(66-55)+55);
totalWait+=cash1salad;
break;
case 1:
cash1burger=(rand()%(131-111)+111);
totalWait+=cash1burger;
break;
}
}
else if (cash2empty=TRUE)
{
cash2empty=FALSE;
switch(rand()%2)
{
case 0:
cash2salad=(rand()%(76-65)+65);
totalWait+=cash2salad;
break;
case 1:
cash2burger=(rand()%(141-121)+121);
totalWait+=cash2burger;
break;
}
}
else
{
queue++; // ???
/// I DON'T KNOW WHAT I'M DOING.
}
对于给您带来的不便,我深表歉意,但我不能使用“结构”。数组是可以接受的!
我是一名优秀的程序员,十分优秀!