Intelligent Parking Building
题目描述
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.
输入
•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.
输出
样例输入
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
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;int T,n,m,a[55][55],row[55];
struct point{int x;int y;
}p;int judge(){for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)if(a[i][j]!=-1)return 1;return 0;
}int main()
{scanf("%d",&T);while(T--){scanf("%d%d",&n,&m);for(int i=0;i<=n;i++)row[i]=1;for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)scanf("%d",&a[i][j]);int count=1,flag,sum=0;while(judge()){flag=1;for(int i=1;i<=n&&flag;i++){for(int j=1;j<=m&&flag;j++){if(a[i][j]==count){if(m-max(row[i],j)+min(row[i],j)>abs(j-row[i]))sum=sum+(abs(j-row[i]))*5+(i-1)*20;elsesum=sum+(m-max(row[i],j)+min(row[i],j))*5+(i-1)*20;row[i]=j;count++;flag=0;a[i][j]=-1;}}}}printf("%d\n",sum);}return 0;
}
Intelligent Parking Building相关推荐
- 河南省第十届省赛 Intelligent Parking Building
title: Intelligent Parking Building 河南省第十届省赛 tags: [模拟,省赛] 题目描述: There is a new revolution in the pa ...
- 河南省第十届大学生程序设计竞赛 A,B,C,D,F,G,H 题解
H: Intelligent Parking Building 时间限制: 1 Sec 内存限制: 128 MB 提交: 22 解决: 20 [提交][状态][讨论版] 题目描述 There is ...
- 河南省第十届ACM赛题
本届赛题难度不是太大,9道题目我们队一共做了7道拿了个银,很遗憾没有能为我们学校带来首金. 贴上我们队的ac的代码留个纪念,题目我就不一个一个字码出来了,直接上照片,没做的题我就不在贴了... A题: ...
- Python停车管理系统毕业设计-附源码271400
摘 要 21世纪时信息化的时代,几乎任何一个行业都离不开计算机,将计算机运用于停车场管理也是十分常见的.过去使用手工的管理方式对停车进行管理,造成了管理繁琐.难以维护等问题,如今使用计算机对停车场停车 ...
- python+停车管理系统 毕业设计-附源码271400
Python停车管理系统 摘 要 21世纪时信息化的时代,几乎任何一个行业都离不开计算机,将计算机运用于停车场管理也是十分常见的.过去使用手工的管理方式对停车进行管理,造成了管理繁琐.难以维护等问题, ...
- 吴恩达登录知乎,亲自回答如何系统学习机器学习
如何系统地学习机器学习?知乎里有很多回答,近日,吴恩达老师亲自在知乎回答了这个问题: 作者:吴恩达 链接:https://www.zhihu.com/question/266291909/answer ...
- 细数家庭安防五大乱象 何时能步入正轨
虽然智能家居行业在我国的成长已逾十个年头了,但是目前市场离成型仍然有一段距离.市场上可谓"乱象"丛生,这些绊脚石严重阻碍了行业的良性发展.市场乱象繁生,智能家居从概念炒作到价格高抬 ...
- 先进驾驶辅助系统(ADAS) 术语
国家在2021-06-01日开始实施国标GB/T 39263-2020 版的关于先进驾驶辅助系统相关的术语与定义.下面是我整理的术语相关的内容,如果需要更为详细的定义,请点击文章后面的连接进入到国家 ...
- 基于SSM的停车场管理系统
摘 要 自从进入21 世纪以后,汽车产业迅速发展,伴随着人们生活程度的日益进步的人口的迅速增加,汽车的数量也如雨后春笋般在城市里不断的增加.这种现象,一方面是值得我们高兴的,这代表着我们国家的经济发展 ...
最新文章
- Cookie 位置_无需整理
- JAVA接口的访问权限_Java中访问权限-类和接口
- Windows驱动开发学习笔记(四)—— 3环与0环通信(常规方式)
- mysql数据库备份出错_mysql数据库备份成功,再还原却失败,什么原
- 关于MultipleOutputFormat若干小记
- [蓝桥杯][算法提高VIP]学霸的迷宫(bfs+dfs)
- 小米8ios图标包下载_小米互传PC端抢先下载,免流量、高速互传,支持多设备共享...
- 本科毕设论文——基于Kinect的拖拉机防撞系统
- python字典数据类型笔记_python笔记2-数据类型:元组、字典常用操作
- 计算机工作应用工作简历,计算机应用专业工作简历范文
- [React Native Android 安利系列]样式与布局的书写
- Faster-Rcnn扫盲
- 乐高mindstormsev3_lego mindstorms ev3下载-乐高EV3机器人编程软件1.3.1 家庭版-东坡下载...
- 在北京买车可以上外地牌照吗
- c语言程序的函数组成包括两个部分,c语言函数由哪两部分组成
- 如何查找一篇论文的实现代码从而复现论文?以及如何查找一篇论文被哪些论文引用?
- 第二章(第四部分) 黑暗之王的分身
- css 字体样式设置大全
- 红米4x android7.0,效率太惊人 红米Note 4X也迎来Android 7.0升级
- Oracle中如何计算时间差