河南省第十届省赛 Intelligent Parking Building

本文介绍了一种新型停车楼的概念及算法实现。该停车楼通过中央电梯和环形传送带自动存取车辆,并分析了如何计算最后一位车主取车所需时间。文章详细解释了算法流程并提供了源代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

title: Intelligent Parking Building 河南省第十届省赛
tags: [模拟,省赛]

题目描述:

There is a new revolution in the parking lot business: the parking  building. The concept is simple: you drive your car into the elevator at the entrance of the building, and the elevator and conveyor belts drag the car to an empty parking spot, where the car remains until you pick it up. When you return, the elevator and conveyor belts move your car back to the entrance and you’re done.

The layout of the building is simple. There is one central elevator that transports the cars between the different floors. On each floor there is one giant circular conveyor belt on which the cars stand. This belt can move in clockwise and counterclockwise direction. When the elevator arrives on a floor, it becomes part of the belt so that cars can move through it.

At the end of the day the building is usually packed with cars and a lot of people come to pick them up. Customers are processed in a first come first serve order: the elevator is moved to the floor of the first car, the conveyor belt moves the car on the elevator, the elevator is moved down again, and so on. We like to know how long it takes before the last customer gets his car. Moving the elevator one floor up- or downwards takes 10 seconds and moving  the conveyor belt one position in either direction takes 5 seconds. 

输入:

On the first line one positive number: the number of testcases, at most 30.  Each test case specifies:

  • One line with two integers h and l with 1 ≤ h ≤ 50 and 2 ≤ l ≤ 50: the height of the parking tower and the length of the conveyor belts.
  • h lines with l integers: the initial placement of the cars. The jth number on the ith line describes the jth position on the ith floor. This number is −1 if the position is empty, and r if the position is occupied by the rth car to pick up. The positive numbers form a consecutive sequence from 1 to the number of cars. The entrance is on the first floor and the elevator (which is initially empty) is in the first position. There is at least one car in the parking tower.

输出:

For each test case generate a single line containing a single integer  that is the number of seconds before the last customer is served.

 样例输入:

3
1  5
1  -1  -1  -1  2 
1  5
2  -1  -1  -1  1 
3 6
-1  5  6  -1  -1  3
-1  -1  7  -1  2  9
-1  10  4  1  8  -1

样例输出:

5
10
320

分析:

表示英语不好的人伤不起,题意都是读了好久才读出来的,心累~~~~

OK,言归正传:

有一个地下车库,车库的高度为h,每层的车库中都有L个停车位,这L个停车位相当于是一个环形的传送带,传送带上有L个位置,每个位置上都可以停一辆车(相当于L个停车位)。有二维数组来表示当前楼层某个停车位上的停车信息,为-1的话意味着这个车位是空的,其余的数字依次表示车主提车的先后顺序(注意提车的时候肯定只能一辆一辆的提)。

让求得就是最后一位车主需要多久的时间才能够提到车,电梯上或者下一层所需10个单位时间,传送带转动一个车位需要5个单位时间,当然传送带可以正转也可以逆转。

首先肯定的是只能够一辆车一辆车的提,不能够在提一辆车的过程中顺便把下一辆车也提出去,这是不符合实际情况也不符合题意。然后就是关于传送带的位置问题(这里所说的位置都是传送带在楼梯口的那个位置,最开始的时候每一层都是一号位置),原先我就一直以为的是传送带在把车送到楼梯口后,就又回到原来的位置了,然后才意识到自己考虑的多了,传送带在把一辆车送到电梯口之后,传送带就不再动了,当前位置就是下一次的传送带的位置。

代码:

#include<stdio.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
struct Node
{
    int floor;///楼层
    int num;///停车位
} node[2509];
int main()
{
    int T,n,m,Max;
    scanf("%d",&T);
    while(T--)
    {
        Max=-1;
        memset(node,NULL,sizeof(node));///结构体整体初始化
        int Tu[52][52];
        scanf("%d%d",&n,&m);
        for(int i=1; i<=n; i++)
        {
            Tu[i][0] = 1;///每一层最开始的时候传送带的位置都是1
            for(int j=1; j<=m; j++)
            {
                scanf("%d",&Tu[i][j]);
                if(Tu[i][j]!=-1)
                {
                    if(Tu[i][j]>Max)///max表示的是最多有多少辆车需要提出去
                        Max=Tu[i][j];
                    node[Tu[i][j]].floor=i;///楼层赋值
                    node[Tu[i][j]].num=j;///停车位赋值
                }
            }
        }
        int  sum=0,flag;
        for(int i=1; i<=Max; i++)
        {
            sum+=(node[i].floor-1)*10*2;///每次提车的过程都相当于从一楼到停车楼层,在送回一楼,则电梯的时间加倍
            int mm = min(abs(node[i].num - Tu[node[i].floor][0]),m- abs(node[i].num - Tu[node[i].floor][0]));   
            ///在同行中,找距离左右两边最近的那个。
            sum += mm * 5;
            Tu[node[i].floor][0]=node[i].num;///传送带的位置有记忆功能
        }
        printf("%d\n",sum);
    }
    return 0;
}

转载于:https://www.cnblogs.com/cmmdc/p/6887779.html

内容概要:本文深入探讨了金属氢化物(MH)储氢系统在燃料电池汽车中的应用,通过建立吸收/释放氢气的动态模型和热交换模型,结合实验测试分析了不同反应条件下的性能表现。研究表明,低温环境有利于氢气吸收,高温则促进氢气释放;提高氢气流速和降低储氢材料体积分数能提升系统效率。论文还详细介绍了换热系统结构、动态性能数学模型、吸放氢特性仿真分析、热交换系统优化设计、系统控制策略优化以及工程验证与误差分析。此外,通过三维动态建模、换热结构对比分析、系统级性能优化等手段,进一步验证了金属氢化物储氢系统的关键性能特征,并提出了具体的优化设计方案。 适用人群:从事氢能技术研发的科研人员、工程师及相关领域的研究生。 使用场景及目标:①为储氢罐热管理设计提供理论依据;②推动车载储氢技术的发展;③为金属氢化物储氢系统的工程应用提供量化依据;④优化储氢系统的操作参数和结构设计。 其他说明:该研究不仅通过建模仿真全面验证了论文实验结论,还提出了具体的操作参数优化建议,如吸氢阶段维持25-30°C,氢气流速0.012g/s;放氢阶段快速升温至70-75°C,水速18-20g/min。同时,文章还强调了安全考虑,如最高工作压力限制在5bar以下,温度传感器冗余设计等。未来的研究方向包括多尺度建模、新型换热结构和智能控制等方面。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值