爆刷PAT(甲级)——之【1144】 The Missing Number(20 分)——排序

STM32HAL库 基于外部Flash+FatFs模拟U盘方式进行固件拷贝升级(详解) STM32HAL库 基于外部Flash+FatFs模拟U盘方式进行固件拷贝升级 阅读详情

题意:给一个序列,输出序列里没有出现的最小的正数。

思路:N小于100000,所以排序以后,输出第一个衔接不上的正数,屁股后面那个数就好了。

Code:

#include<bits/stdc++.h>
using namespace std;
#define inf 100009
#define INF 0x3f3f3f3f
#define loop(x,y,z) for(x=y;x<z;x++)
int e[inf];
int main()
{
    int i,j,n;
    scanf("%d",&n);
    loop(i,0,n)scanf("%d",&e[i]);
    sort(e,e+n);
    int ans=1;
    loop(i,0,n)
        if(e[i]>ans&&e[i]>ans+1)break;
        else if(e[i]==ans)ans++;
    printf("%d\n",ans);
    return 0;
}

 

Linux - xarray 工具类 第三层节点直接与绿色的值绑定,若需要像数组一样通过下标访问绿色的值对象那么需要给每一个节点进行编码,这样通过根节点即可访问到具体的对象。对于未使用到的小数组不申请空间,这样只需设计一种方法将这些非连续的小数组在一个数据结构中组织在一起即可,对于这个数组结构需要具有结构紧凑并且能够快速定位到对应的小数组段上,这时候树形结构上场了。一个很大的数组必然可以由一个个小数组拼接而成,若定义一个最小粒度的数组长度,比如长度4,那么从宏观上看一个大数组就由一个个长度为4的小数组排队而成。 阅读详情

相关推荐

使用Label Studio标注车牌数据:YOLOv26模型训练指南

在计算机视觉领域,数据标注是模型训练的基础环节,直接影响最终模型的识别精度。Label Studio作为专业的标注工具,支持多种标注类型和格式导出,特别适合目标检测任务的数据准备。通过多边形标注技术,可以精确捕捉车牌的四个角点,生成旋转矩形框(OBB)标注数据,这种标注方式相比传统水平框能更好地处理倾斜车牌场景。标注完成后,数据可导出为YOLO格式,直接用于YOLOv26等先进目标检测模型的训练。在实际工程中,合理的标注策略和严格的质量控制能显著提升车牌识别模型在复杂场景下的鲁棒性,适用于智能交通、停车场管

chuozhi7142的博客 906

PAT 1144 The Missing Number(20 分)

Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specification: Each input file contains one test case. For each case, the first line giv...

Hickey_Chen的博客 360

态路小课堂丨三款800G光模块方案介绍—SR8/DR8/2FR4

800G QSFP-DD 2FR4光模块使用CWDM4波长(1271/1291/1311/1331nm),单通道速率为100G,通过MUX减小光纤的数目,其光学接口采用CS接口或双芯LC接口。

poposu的博客 2398

1144 The Missing Number(20 分)

1144 The Missing Number(20 分)提问 Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specification: Each input file contains one test case. ...

Become hunger become strong 819

silvaco(TCAD)击穿特性仿真,的不收敛问题

在silvaco仿真学习过程中,最近这段时间一直有一个很大的问题困扰着我,那就是我在仿真击穿特型曲线的过程中,在电压加到后期比较大的情况下,往往会出现仿真不收敛的情况,正常情况下器件的击穿应该在一个外加偏压上,电流出现迅速的上升,这才是击穿的定义,但是我仿真的过程中程序跑到一个较大的电压时,器件出现击穿,我观察电压电流曲线,在击穿电压(程序报告的)电流并没有出现迅速的变化,类似于下图这种形式。(2)解决方法,将初始电压调整到合适的值,这个值可能是更大的也可能是更小的,要注意多多尝试。

zm19992533002908的博客 4955

RK3566添加ffpeg【Buildroot系统】

有很多人都发现了RK3566系列的芯片是不可以直接使用ffmpeg官网源码的!会报错: Not a video capture device. /dev/video0: No such device 接下来我们就来解决这个问题!!

honmy18的博客 4081

PAT 1144. The Missing Number (20) - 甲级

Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list.Input Specification:Each input file contains one test case. For each case, the first line gives a...

柳婼 の blog 1709

nRF开发环境搭建全攻略:VS Code + nRF Connect SDK + Zephyr实战

嵌入式开发中,环境配置往往是新手入门的第一道障碍,尤其面对基于Zephyr RTOS的Nordic nRF平台时,工具链的复杂度常让人望而却步。理解构建系统、SDK版本管理和调试工具之间的协作关系,是高效开发的前提。Zephyr作为开源实时操作系统,通过设备树和Kconfig实现硬件描述与功能配置,而nRF Connect SDK(NCS)则是Nordic基于Zephyr的增强发行版,两者结合为物联网开发提供了强大支持。基于VS Code搭建开发环境,配合west工具管理多仓库、CMake/Ninja执行构

weixin_29188997的博客 231

1144 The Missing Number (20 分)

Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specification: Each input file contains one test case. For each case, the first line ...

92377 353

Win11网络卡顿?用Wireshark抓包5分钟定位问题(保姆级实战)

本文详细介绍了如何使用Wireshark在Win11系统中快速定位网络卡顿问题。通过5分钟抓包分析,作者成功发现TCP重传率高达37%的罪魁祸首,并提供了从准备工作到实战分析的保姆级教程,帮助用户解决游戏卡顿、视频会议延迟等常见网络问题。

weixin_28839629的博客 316

指纹浏览器降维打击(下):Cloudflare Turnstile 与 hCaptcha 的底层交互逻辑

本文将深度拆解:Turnstile 与 hCaptcha 的 Iframe 沙箱通信机制,动态混淆 JS 与 PoW(工作量证明)的物理破解法则,以及如何通过 C++ 底层事件合成与环境基因强绑定,实现验证码的“无感过验”。

数据知道的博客 432

1144 The Missing Number(20 分)

Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specification: Each input file contains one test case. For each case, the first line giv...

ysq96的博客 501

MeloTTS 生成 RKNN 模型

摘要: 本方案基于RK3588平台,利用RKNN工具链实现高效语音合成(TTS)。采用MeloTTS开源模型,支持中英文混合语音生成。部署流程包括:1) 导出ONNX模型;2) 转换为RKNN格式;3) 在RK3588开发板运行。关键步骤包含环境配置(RKNN Toolkit2≥1.4.0)、模型转换(非量化处理)及音频处理实现。方案充分发挥RK3588的NPU加速能力,适用于边缘设备语音合成场景

J。 355

【PAT甲级 - C++题解】1144 The Missing Number

📣专栏定位:为想考甲级PAT的小伙伴整理常考算法题解,祝大家都能取得满分!

Newin2020的博客 529

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

PAT 甲级 1144 The Missing Number

题目: 解题思路: 用n控制输入的数字个数 将输入的数字都存入数组中 如果数字的数值在1至10^5之间 将数组中对应于此数值的地址标记为1 for循环从地址下标1至10^5开始寻找标记为0的 找到第一个为0的地址则将对应的i输出 #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main() { int n,i...

zouzou_的博客 220

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

1144 The Missing Number-PAT甲级(数的排序+遍历)

Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specification: Each input file contains one test case. For each case, the first line giv...

amf12345的博客 185

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

【2019暑期】【PAT甲级】1144 The Missing Number (20 分)

挺水的,简单到刚读完题还以为自己理解错了题意,, 不用map最后一个点会报段错误 注意都是负数的时候输出的是1,不是0 #include <cstdio> #include <cstdlib> #include <algorithm> #include <iostream> #include <string> #include <c...

咸鱼之井的博客 150

PAT——1144 The Missing Number 甲级

1144 The Missing Number题目题意题解AC代码注意 题目 https://pintia.cn/problem-sets/994805342720868352/problems/994805343463260160 题意 给出待测序列,输出最小的序列中没有的正整数 题解 通过map记录数字是否出现,然后通过循环逐个判断即可 AC代码 #include<bits/stdc++.h> using namespace std; int main() { int n,t,num=1;

ljhsq的博客 155

PAT_甲级_1144 The Missing Number (20point(s)) (C++)【签到题】

目录 1,题目描述 题目大意 2,思路 3,AC代码 4,解题过程 第一搏 第二搏 1,题目描述 Sample Input: 10 5 -25 9 6 1 3 4 2 5 17 Sample Output: 7 题目大意 给出N个数,找出其中未给出的最小的正数。 2,思路 第一时间就想到了桶式排序。 声明一个bool数组,一个萝卜一个坑,除...

&再见萤火虫&的博客 256

PAT甲级 1144 The Missing Number(20 分)

题目链接#include &lt;iostream&gt; #include &lt;bits/stdc++.h&gt; #include &lt;algorithm&gt; using namespace std; int main() { int n; while(~scanf("%d",&amp;n)) { int arr[100000+1]; ...

Q_smell的博客 345

【PAT 甲级】1144 The Missing Number(20 分)

题目链接Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list.Input Specification:Each input file contains one test case. For each case, the first line giv...

feng_zhiyu的博客 445

PAT甲级A1144 The Missing Number(20 分)

1144 The Missing Number(20 分) Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specification: Each input file contains one test case. Fo...

vir_lee的博客 316

PTA甲级考试真题练习144——1144 The Missing Number

题目 思路 使用set集合兼并了去重加排序的过程,再遍历set集合哪个数字没有就break 代码 #include <iostream> #include <set> using namespace std; int main() { int n; cin >> n; set<int> vec; for (int i = 0; i <...

醉等佳人归 220

PAT甲级--1144 The Missing Number(20 分)

1144 The Missing Number(20 分) Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specification: Each input file contains one test case. Fo...

Imagirl1的博客 263

HDU 1251 统计难题 (哈希)

#include<bits/stdc++.h> using namespace std; #define debug puts("YES"); #define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++) #define ll long long #define ull unsigned long long #define lrt in...

满月照亮的路 365

1144 The Missing Number (20 分)

map的应用,注意使用数组hash会在最后一个测试点上超时,而且数组开不了int范围大小的空间。 #include&lt;cstdio&gt; #include&lt;cstring&gt; #include&lt;unordered_map&gt; using namespace std; int main(){ int n,x; unordered_map&lt;int,bool&gt; ...

姚军 372
上一篇: 爆刷PAT(甲级)——之【1146】 Topological Order(25 分)——拓扑排序
下一篇: 爆刷PAT(甲级)——之【1145】 Hashing - Average Search Time(25 分)——Hash
仰天倀笑
博客等级 码龄10年 313粉丝 124原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值