PAT 1022. Digital Library (30)

AS7262六通道可见光传感器:从光谱原理到物联网色彩检测实战 光谱检测是嵌入式感知领域的关键技术,其核心原理是通过特定波长的滤光片分离光线并转换为电信号,从而实现对环境光或物体反射光的成分分析。这项技术的价值在于将复杂的光学分析简化为可编程读取的数字信号,极大降低了色彩检测在物联网和智能设备中的应用门槛。在智能农业、工业分拣、环境监测等场景中,精确的光谱数据能够驱动自动化决策,例如评估植物光照条件或识别物料颜色。本文以Adafruit AS7262传感器为例,深入解析其基于硅干涉滤光片的六通道设计,并通过Arduino与Python实战,演示如何快速构建从数据采集到可 阅读详情

A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number as its ID. Given any query from a reader, you are supposed to output the resulting books, sorted in increasing order of their ID's.

Input Specification:

Each input file contains one test case. For each case, the first line contains a positive integer N (<=10000) which is the total number of books. Then N blocks follow, each contains the information of a book in 6 lines:

  • Line #1: the 7-digit ID number;
  • Line #2: the book title -- a string of no more than 80 characters;
  • Line #3: the author -- a string of no more than 80 characters;
  • Line #4: the key words -- each word is a string of no more than 10 characters without any white space, and the keywords are separated by exactly one space;
  • Line #5: the publisher -- a string of no more than 80 characters;
  • Line #6: the published year -- a 4-digit number which is in the range [1000, 3000].

It is assumed that each book belongs to one author only, and contains no more than 5 key words; there are no more than 1000 distinct key words in total; and there are no more than 1000 distinct publishers.

After the book information, there is a line containing a positive integer M (<=1000) which is the number of user's search queries. Then M lines follow, each in one of the formats shown below:

  • 1: a book title
  • 2: name of an author
  • 3: a key word
  • 4: name of a publisher
  • 5: a 4-digit number representing the year

Output Specification:

For each query, first print the original query in a line, then output the resulting book ID's in increasing order, each occupying a line. If no book is found, print "Not Found" instead.

Sample Input:
3
1111111
The Testing Book
Yue Chen
test code debug sort keywords
ZUCS Print
2011
3333333
Another Testing Book
Yue Chen
test code sort keywords
ZUCS Print2
2012
2222222
The Testing Book
CYLL
keywords debug book
ZUCS Print2
2011
6
1: The Testing Book
2: Yue Chen
3: keywords
4: ZUCS Print
5: 2011
3: blablabla
Sample Output:
1: The Testing Book
1111111
2222222
2: Yue Chen
1111111
3333333
3: keywords
1111111
2222222
3333333
4: ZUCS Print
1111111
5: 2011
1111111
2222222
3: blablabla
Not Found

思路:题目有点长,主要要求是输入书本的相关信息,然后输入5种索引方式在这些书本信息中寻找匹配的结果。

 
#include<iostream>
#include<string>
#include<sstream>
#include<vector>
#include<algorithm>

using namespace std;

struct book { //书的信息
	string id;
	string name;
	string ath;
	vector<string> key;
	string pub;
	string time;
};   

int main()
{
	int n, m;
	string s, st;
	cin >> n;
	vector<book> b(n);
	for (int i=0; i!=n; ++i) { //输入书的信息
		cin >> b[i].id;
		cin.ignore();
		getline(cin, b[i].name);
		getline(cin, b[i].ath);
		getline(cin, s);
		istringstream is(s); //拆分字符串成为单独的关键字
		while (is >> s) 
			b[i].key.push_back(s);
		getline(cin, b[i].pub);
		cin >> b[i].time;
	}
	cin >> m;
	cin.ignore(); //在cin后用getline需要用,不然getline读入空行
	while(m--) {
		string s, st;
		vector<string> v;
		getline(cin, s);
		cout << s << endl;
		st.assign(s.begin()+3, s.end()); //索引内容
		for (int i=0; i!=n; ++i)  //按索引寻找书本匹配项
			if (st == b[i].name || st== b[i].ath || st==b[i].pub 
				|| st == b[i].time ||find(b[i].key.begin(), b[i].key.end(), st) != b[i].key.end() )
				v.push_back(b[i].id);

		sort (v.begin(), v.end()); //结果按id排序
		if (v.empty())
			cout << "Not Found" << endl;
		else
			for (int j=0; j!=v.size(); ++j)
				cout << v[j] << endl;
	}
	system("pause");
}


IEDA激活码失效?教你5分钟快速续期的方法 本文针对IEDA激活码失效问题,提供了一套从快速应急到深度排查的完整解决方案。文章不仅详解了5分钟快速续期与清理缓存等应急方法,更深入剖析了授权机制、离线激活流程,并指导如何构建可持续的授权管理策略,帮助开发者彻底解决激活困扰,确保开发环境稳定。 阅读详情

相关推荐

Axure RP 10表单数据提交制作

本文介绍了如何使用Axure RP 10实现表单数据提交。

Peppaaa的博客 990

Digital Library

A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number a

sheng_xc的专栏 627

手把手教你用TI MOSFET搭建0-100mA恒流源电路(附避坑指南)

本文详细介绍了如何使用TI MOSFET SI1204D搭建0-100mA恒流源电路,包括基础原理、电路设计、PCB布局和热管理技巧。通过分步指导和避坑指南,帮助工程师实现高精度、低成本的电流控制方案,适用于LED驱动、传感器激励等多种应用场景。

weixin_29310631的博客 484

基于 CST 建模仿真的微波暗室性能评价方法

本文探讨了利用CST电磁仿真软件优化微波暗室设计的方法。针对传统暗室建设成本高、尺寸不可更改的问题,研究通过建立吸波材料模型(含碳聚氨酯角锥)和暗室结构模型(34m×32m×20m),采用CST的渐进求解器进行性能仿真。结果表明:在1-4GHz频段内反射系数低于-35dB,静区反射电平达-40dB,交叉极化隔离度优于25.8dB,场均匀性和多路径损耗均满足GJB6780-2009等标准要求。该方法实现了暗室建设前的性能预测,已成功应用于工程实践,有效降低了试错成本。

a18665053298的博客 545

数字孪生驱动的城市地下管网智能运维与应急处置决策支持系统

上海市城市数字化中心的数据实践显示,通过关联分析管网材质与故障率的关系,将铸铁管更换周期从15年优化至8年(李敏,2021)。环境效益方面,上海市通过优化管网运行参数,年减少碳排放1.8万吨,相当于种植36万棵乔木。数字孪生与物理设备的双向交互采用OPC UA协议实现,某次天津管网渗漏事件中,系统通过实时数据反馈,指导现场人员调整注浆方案,将修复时间从48小时压缩至16小时。虚拟指挥沙盘支持多视角协同,深圳水务系统的实践表明,通过AR可视化技术,跨部门会议效率提升60%,方案决策时间缩短40%。

2501_92431686的博客 1426

(10)Proteus 8.9上的STM32仿真系列(HAL)---freertos

实验设计:通过cubemxide生成freertos工程,然后创建一个 pc13 led灯间隔200ms闪烁的任务。非常遗憾的是proteus8.9仿真失败,实物上没有问题,但还是把流程过一遍。 一、原理图 实物是淘宝上stm32f103 c8t6的核心板,proteus上没有这个芯片,这里图上大概表示一下,用的是核心板自带的pc13引脚的led灯。 二、cubemxide配置 1.RCC如之前工程一样配置 2、配置SYS timebase Source不要使用systick,自己选择一个定时器,我这

qq_35442550的博客 7344

PAT甲级 -- 1022 Digital Library (30 分)

A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number a...

猪の成长日记 239

2025年(第十一届)全国大学生统计建模大赛论文及选题分析

基于数据驱动决策:整个研究围绕给定的洪水灾害相关数据进行深入挖掘和分析,从数据清洗、特征分析、模型建立到最终预测,每一步都以数据为基础,通过对数据的有效利用来揭示洪水灾害发生的相关规律和特征,为洪水灾害的风险评估和预测提供依据,符合数据引领未来决策的理念。实际应用导向:洪水灾害是现实中严重影响人类生命财产安全和社会经济发展的重要问题,本研究旨在实现对洪水灾害的预测,其成果可直接应用于防洪减灾工作,如洪水预警、风险评估与区划等,对实际防灾减灾工作具有重要的指导意义,体现了以数据为支撑服务实际应用的特点。

qq_52590045的博客 1万+

1022 Digital Library (30 分)

A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number a...

chen_zan_yu_的博客 256

Level 4自动驾驶系统设计49——L4 架构设计 2

在 9.3.2 节所述的 SerDes 晶圆级原生“双出(Splitter Mode)”物理架构中,若解串芯片内部的其中一路 MIPI 供电轨因大算力 SoC 1 的高热漏电流污染突发二阶瞬态电磁耦合,导致双出通道产生 $\mathbf{\Delta} \text{Skew} \ge 15\text{ps}$ 的时序偏置。其中,$\mathbf{H}(t)$ 为最低限度生存网雷达几何测量的观测矩阵,$\mathbf{R}_{\text{fallback}}$ 为清洗后的雷达测量不确定度协方差。

Godspeed_zwh的博客 309

24、水下传感器网络中混合LEACH协议与遗传算法获取路由节点

本文提出了一种结合遗传算法与LEACH协议的混合路由方案,用于提升水下无线传感器网络(UWSN)的能量利用效率和数据传输稳定性。通过遗传算法优化簇头选择与路径规划,有效避免节点过早死亡,减少能量消耗,在200个节点场景下显著提升网络寿命。相比传统LEACH协议,该方案具有更高的能量利用率、更强的环境适应性,并支持传输历史记录与并行传输序列。实验结果显示,该方案在总能量为2000焦耳时剩余能量达75.6%,远优于LEACH的34.8%能耗表现。适用于海洋监测、石油平台监控及水下灾害预警等复杂环境应用。

i8j9k0l1的博客 112

C++ vector的使用(一)

vector类似于数组。

的博客 1127

基于深度学习的堰塞坝表层颗粒物质识别研究

本文提出一种基于深度学习的堰塞坝表层颗粒物质智能识别方法,针对颗粒分布散乱、背景复杂的问题,采用"大颗粒逐个识别、密集小颗粒分块识别"策略。结合Mask R-CNN、SLIC和AlexNet构建识别模型,通过无人机影像实现自动识别。实验表明该方法精度超过90%,具备迁移能力。文章提供了Python实现代码,涵盖数据预处理、SLIC分割、模型构建(Mask R-CNN和AlexNet)及训练流程,为堰塞坝应急抢险提供技术支持。

huanghm88的专栏 181

PAT甲级 - 1022 Digital Library (30 分)

题目链接:PAT甲级 - 1022 Digital Library (30 分) A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each b...

284

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

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

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

1022 Digital Library (30 分)-PAT甲级

A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number as its ID. Given any query from a reader, you are suppose

神笔码农.的博客 535

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

PAT 1022 Digital Library (30 分)

1022 Digital Library (30 分) A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigne...

peanWang的博客 226

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

PAT习题解:1022. Digital Library (30)

题目链接:http://www.patest.cn/contests/pat-a-practise/1022 这道题目我没想到什么好办法做,最后参考了闲云阁的文章,用map 和 set 做出来,算是顺便学习了一下 STL 里面 map 和 set 的用法。话说C++的输入输出真是麻烦啊,这题用Python做的话写起来会很简单吧。 #define _CRT_SECURE_NO_WARNING

by21010的专栏 760

PAT甲级 1022 Digital Library (30分)

1022 Digital Library (30分) 题目链接:PAT A 1022 题目大意:有一数字图书馆,对于每一本书给出如下信息:书的id,书的名字,书的作者,书的关键字,书的出版社以及书的出版年份。要求根据输入的查找信息输出相应书的ID(7位数字)。 思路分析:这道题题意很直观,但是需要用到的知识点比较多。首先根据题目要求可以分析出这道题一定是使用STL中的map去解决,而且由于题...

weixin_43684054的博客 217

PAT 1022 Digital Library (30)

首先是数据结构,gets的行输入以及scanf会接收末尾空格 strstr(str,substr)寻找str中是否有substr,没有返回null 最后sort一下,控制格式为%07d即可 #include #include #include #include #include using namespace std; const int N=10005; int cnt=0,n,

dimhat的专栏 789

[C++] PAT 1022 Digital Library (30分)

Sample Input: 3 1111111 The Testing Book Yue Chen test code debug sort keywords ZUCS Print 2011 3333333 Another Testing Book Yue Chen test code sort keywords ZUCS Print2 2012 2222222 The Testing Book CYLL keywords debug book ZUCS Print2 2011 6 1: The Tes.

快乐de约定的博客 2212

PAT A1022 Digital Library (30分)

题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805480801550336 题目描述 A Digital Library contains millions of books, stored according to their titles, authors, key words of their abst...

Rhao的博客 285

PAT A1022. Digital Library (30)

A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number a

jolivan的博客 248

[PAT] 1022 Digital Library (30 分) Java

A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit num...

Simma1101的博客 213

PAT 甲级 1022 Digital Library (30分)

原题链接:1022 Digital Library (30分) 题目大意: 一本书,只有一位作者,包含的关键词不超过 5 个。 总共不超过 1000 个不同的关键词,不超过 1000 个不同的出版商。 图书信息介绍完毕后,有一行包含一个整数 M,表示查询次数。 当读者查询某一关键信息时,你应该找到所有与查询相关的书籍,并将它们按 ID 的升序排序输出。 分析: 难点和重点在于:对字符串的读入和处理。 有格式的字符串用 scanf() 比较好 普通无空格字符串用cin 包含空格的字符串用 getline(),

EP的别三日 256

PAT 甲级 1022 Digital Library (30 分)

1022 Digital Library (30 分) A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assign...

liuxinghui_SJTU的博客 245

PAT甲级1022 Digital Library (30 分)

1022Digital Library(30分) A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assign...

Dexter 213
上一篇: PAT 1025. PAT Ranking (25)
下一篇: PAT 1028. List Sorting (25)
byhj
博客等级 码龄14年 1粉丝 83原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值