http://acm.hdu.edu.cn/showproblem.php?pid=1103
模拟,优先级队列,
注意等待的情况,若值得等待,则被等的人出队,保持时间的连续性
#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
int main()
{
int a,b,c,ta[3],h,min,ti,diners,res;
int i;
priority_queue<int,vector<int>,greater<int> > table[3];
char s[7];
while(scanf("%d%d%d",&a,&b,&c)==3&&a)
{
ta[0]=ta[1]=ta[2]=res=0;
while(scanf("%s",s)==1&&s[0]!='#')
{
ti=0;
scanf("%d",&diners);
for(i=0;s[i]!=':';++i)
该博客主要介绍了如何模拟解决HDU 1103题目的过程,涉及到了优先级队列的使用。在处理过程中,特别强调了要注意判断是否值得等待的情景,如果值得等待,则需要将被等待者从队列中移除,以确保时间顺序的正确性。
订阅专栏 解锁全文
246

被折叠的 条评论
为什么被折叠?



