文章

326

粉丝

4

获赞

551

访问

239.8k

头像
排队打饭 题解:
P997 复旦大学2020年机试题
发布于 2026年2月
阅读数 375

#include<stdio.h>
#include<queue>
#include<math.h> 
using namespace std;
int main()
{
    long long int n;
    scanf("%lld",&n);
    queue<long long int> my1;
    queue<long long int> my0;
    queue<long long int> my2;
    long long int cur=0;//用于表示现在的时间 
    long long int a,t,b;//a是到达队伍的时刻,t是打饭的时间,b是耐心等待的时间 
    for(int i=0;i<n;i++)
    {
        scanf("%lld %lld %lld",&a,&t,&b);
        my0.push(a);
        my1.push(t);
        my2.push(b);
    }
    while(!my1.empty())
    {
        if(cur<=my0.front()+my2.front())
     &n...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发