pat1008Elevator (20)

PAT甲级真题——1008 Elevator (20 分) 1008 Elevator (20 分) The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified ... 阅读详情

题意分析:

(1)水题,没什么好分析的

坑点:

(1)第一个数差点看错为为电梯到达的第一个楼层,有没有被坑。。。

#include <iostream>

using namespace std;

int main()
{
    int N,i=0;
    cin>>N;
    int preFloor=0,currFloor,total=0;
    while(i<N)
    {
        cin>>currFloor;
        if(currFloor>preFloor)total+=(currFloor-preFloor)*6+5;
        else total+=(preFloor-currFloor)*4+5;
        preFloor=currFloor;
        i++;
    }
    cout<<total<<endl;
    return 0;
}


相关推荐

雪莉果的Axure原型工厂vol.006 中继器应用(二)——多选穿梭框

如果你用axure有一段时间了,那么你很快就能琢磨出一个大体设计流程,比如加一个中间过度的元件,来储存需要穿梭的内容;但是如果你再想一想,就会发现,这样做,似乎只能解决单选,那么多选需要怎么操作呢? 这时候,中继器就会告诉你,我还能做的更多。

weixin_43829792的博客 977

1008Elevator

The highest building in our city has only one elevator. A request list is made up withNpositive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seconds to..

xl16655122713的博客 1021

Lede(OpenWrt)安装和双宽带叠加

LEDE是一个专为路由器和嵌入式设备设计的自由和开源的操作系统。LEDE是OpenWRT项目的一个分支项目。LEDE操作系统包括许多路由器有用的功能,如网络地址转换、防火墙、端口转发、DHCP服务器等。

我的博客 6441

1008 Elevator

1008 Elevator (20 分) The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified ...

weixin_43482621的博客 229

GitHub与GitLab中的Fork操作:从个人仓库到团队协作的完整指南

本文详细介绍了GitHub与GitLab中的Fork操作,从个人仓库到团队协作的完整指南。通过Fork操作,开发者可以在权限隔离的环境下自由实验,并通过合并请求机制保证代码质量。文章涵盖了Fork的具体步骤、本地开发环境配置、代码同步方法以及高级协作技巧,帮助团队高效管理代码仓库。

weixin_28829325的博客 306

Zemax实现微透镜阵列光束整形(原理+仿真)

通过Zemax实现微透镜阵列的光场整形仿真。

VJCP_90909Bu0的博客 1万+

PAT 1008. Elevator (20)(简单加法)

题目1008. Elevator (20)时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue The highest building in our city has only one elevator. A request list is made up with N positive numb

hxshine的博客 399

YOLOv11增量学习数据回放优化:解决新类别引入时的灾难性遗忘问题

本文提出了一种基于生成式潜在回放和提示学习的YOLOv11增量学习系统,旨在解决目标检测中的灾难性遗忘问题。系统采用改进的YOLOv11骨干网络,结合条件变分自编码器生成旧类别特征,并通过渐进式提示调优模块实现高效参数更新。关键技术包括:1) C3k2模块和C2PSA注意力增强特征提取;2) CLIP引导的VAE潜在空间数据回放;3) 类特定与超类别提示相结合的增量调优策略;4) 自适应特征金字塔与显式视觉中心融合机制。实验表明,该方法在保持原有检测性能的同时,显著降低了增量学习过程中的遗忘现象。

本博客聚焦 YOLOv11 全流程落地,涵盖架构优化、数据集处理、训练技巧与多场景部署,兼及国产数据库、Java 开发与 AI 模型应用,内容兼顾理论与工程实践,为开发者提供系统干货,助力高效提升技术能力。 2105

(PAT甲级)1008 Elevator(C语言实现)

code: conclusion: 1、总体思路:本题比较简单,就是一个判断欲停的楼层和当前楼层的一个大小关系,大时上升,小时下降,对时间进行累加求和即可。

qq_40840749的博客 822

智能车图像处理11-进阶篇3--中线累积差值的统计

中线累积差值的统计在后面判断小S,以及长直道的时候都有用到,关键点在于中线的跳变 第12 - 13 行:comulants1 和comlants2代表的是两种不同的累差,取的行数不同 第14-17 行:comulants2取6到25行,其实就是My_Abs(LCenter[i], LCenter[i - 1])的累加 第18-21 行:comulants1去第1到40行 第27- 行: 计算了一下右线的开始于最终结束行,这里判断R_black是否为0,是和中线的提取中g

taiyuezyh的博客 3827

CRC_16---ModBus 计算方法及代码实现

1、 CRC寄存器初始值为 0xFFFF;即16个字节全为1; 2、 CRC-16 / ModBus的多项式0xA001H (1010 0000 0000 0001B) ; ‘H’表示16进制数,‘B’表示二进制数。 计算步骤为: (1).预置 16 位寄存器为十六进制 0xFFFF(即全为 1) ,称此寄存器为 CRC 寄存器; (2).把第一个 8 位数据与 16 位 CRC 寄存器的低位相异或,把结果放于 CRC 寄存器; (3).检测相异或后的CRC寄存器的最低位,若最低位为1,CRC寄存器

1万+

PAT 1008 Elevator(水题)

原题地址https://www.patest.cn/contests/pat-a-practise/1008 题意:给出一组电梯调度的序列,已知上升一层耗时6秒,下降一层耗时4秒,每次停留5秒,求总耗时。 解题思路觉得不应该放在PAT甲级题目里,因为实在没有看到考点。直接模拟计数就可以了。AC代码#include <iostream>using namespace std;int main()

Lecholin的博客 410

NSIS教程(8): 基于第三方界面库的安装包界面

前面的几篇文章介绍了NSIS的传统界面的安装包和现代界面的安装包的制作方法,也提到了NSIS支持自定义页面(即使用page custom)的特性,自定义页面需要用户自己创建对话框、控件、添加控件响应等等,虽然NSIS提供了nsDialogs.nsh来支持这些功能,但使用起来还是不太方便(需要专门了解这个插件诸多用法),而且不够灵活,所以本文介绍一种终极的自定义界面的安装包解决方案,即完全使用第三方

while(1) { smile(); } 9万+

PAT (Advanced Level) 1008 Elevator (20 分) 【Python/C++】【模拟】

PAT (Advanced Level) 1008 Elevator (20 分) 注意:连续两个人都处于同一层,仍需要停留5秒。 Python: import sys str_in = input() a = [int(n) for n in str_in.split()] #print(a) n = int(a[0]) res = int(0) ans = int(0) for i in r...

Irish_Moonshine的博客 380

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

PAT甲级 1008 Elevator (20分)

1008 Elevator (20分) 思路分析:就是统计电梯运行时间,注意满足请求后是不需要返回一楼的。目标楼层比当前楼层高就是楼层差值乘以6,比当前楼层低就是楼层差值乘以四,最后加上电梯在每层的停留时间就可以了~ AC代码: #include<iostream> using namespace std; int main() { int n, temp, begin = 0, ...

weixin_43684054的博客 247

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

【PAT甲级】1008 Elevator (20 分)

1008 Elevator 题目描述: The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified o...

初见还是重逢的博客 346

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

PAT甲级——1008 Elevator (20 分)

这是我写的第一道PAT甲级题目。选择这一道题作为第一题是因为这题通过率最高——0.59。 热烈欢迎大家给出建议。 1008Elevator(20分) The highest building in our city has only one elevator. A request list is made up wi...

海鑫的博客 281

【PAT】1008. Elevator (20)

题目:http://pat.zju.edu.cn/contests/pat-a-practise/1008 简单题。电梯上升要6s,下降要4s,每个stop停靠5s,相加就好。 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN,

此去经年 1648

PAT甲级1008 Elevator (20分)

PAT甲级1008 Elevator (20分) 题目: 题目分析:刚看到题目以为是道dp问题,但仔细一看,这。。。 直接看AC代码吧,小学数学问题。 AC代码附上: #include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ ...

weixin_43795683的博客 213

PAT甲级 - 1008 Elevator (20 分)

题目链接:PAT甲级 - 1008 Elevator (20 分) The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop,...

314

[PAT] 1008 Elevator (20 分)Java

The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs ...

Simma1101的博客 193

PAT 甲级 1008 Elevator (20 分)

题目: PAT 甲级 1008 Elevator (20 分) 经验总结: 定义一个变量cur指向当前电梯位置,初始化为0。 C++代码: #include<bits/stdc++.h> using namespace std; int main() { int n,cur = 0; cin>>n; int sum = 5*n; //先算出总的停留时间 wh...

努力努力再努力 148

PAT A1008 Elevator (20 分)

PAT A1008题目思路初次提交结果 题目 PAT A1008 思路 在输入过程中边求时间即可 初次提交 #include<cstdio> #pragma warning(disable:4996) int main() { int n,temp=0,time=0; scanf("%d", &n); for (int i = 0; i < n; i++) { ...

TC的博客 320

PAT甲级 1008 Elevator(20分)

PAT甲级 1008 Elevator(20分)题目Input Specification:Output Specification:Sample Input:Sample Output:题解题目大意非正规思路挫挫的代码絮絮叨叨参考博客 题目 The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which

weixin_44585441的博客 409

【PAT甲级题解记录】1008 Elevator (20 分)

Problem:1008 Elevator (20 分)Tags:模拟。和上一题一样,由于数组访问顺序具有单调性,其实只需要提供上一个值就可以了,无需数组

retr0的博客 141

PAT 甲级 1008 Elevator (20 分)(Java)

文章目录PAT 甲级 1008 Elevator (20 分)(Java)题目题意解读解法解法一 PAT 甲级 1008 Elevator (20 分)(Java) 题目 题目链接 题意解读 数学题,只需要注意不需要回到0层即可; 解法 解法一 import java.util.Scanner; public class Main_1008 { public static void main(String[] args) { Scanner sc = new Scanner(Sys

盼你到天明的博客 304
上一篇: pat1007Maximum Subsequence Sum (25)
下一篇: pat1009Product of Polynomials (25)
LostStephon
博客等级 码龄11年 14粉丝 59原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值