E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
PAT甲级
PAT甲级
1144The Missing Number
题目链接https://pintia.cn/problem-sets/994805342720868352/problems/994805343463260160题解题目要求给n(小于1e5)个int,找到最小的不在这些数字里的正整数注意点map未创建某元素时,如果直接访问,则其value是一个默认值根据输入样例可知n个数字中可以有重复数字map会按照key自动升序排列这道题也可以暴力解,创建一个
臭咸鱼
·
2020-08-06 23:00
PAT甲级
1132Cut Integer
题目链接https://pintia.cn/problem-sets/994805342720868352/problems/994805347145859072题解给n个k位(k为偶数)的整数z,将其分成a和b,判断z/(a*b)是不是一个整数即可这里要注意a和b是否为0,这是个边界情况,如果没有处理这个边界情况,有2个测试点不能过,只能得14分//Problem:PATAdvanced1132
臭咸鱼
·
2020-08-06 18:00
PAT甲级
1148Werewolf - Simple Version
题目链接https://pintia.cn/problem-sets/994805342720868352/problems/1038429808099098624题解题目要求N(5到100)个玩家,其中2个狼人,只有1个狼人在撒谎(题目里说至少有1个狼人在撒谎但不是所有狼人都在撒谎……直接讲只有1个狼人在撒谎不行吗……),共有2人撒谎,请找出两个狼人描述中+则是人类,-则是狼人如果有解,请按增序
臭咸鱼
·
2020-08-05 23:00
pat 甲级 A1001 A+B Format python两种方法实现
pat甲级
A1001python两种方法实现题目描述Calculatea+bandoutputthesuminstandardformat–thatis,thedigitsmustbeseparatedintogroupsofthreebycommas
zhengzhengzbq
·
2020-08-05 22:39
PAT
python
python
算法
PAT甲级
真题 1102 Invert a Binary Tree (25分) C++实现(找树根,层序、中序遍历翻转二叉树)
题目ThefollowingisfromMaxHowell@twitter:Google:90%ofourengineersusethesoftwareyouwrote(Homebrew),butyoucan’tinvertabinarytreeonawhiteboardsofuckoff.Nowit’syourturntoprovethatYOUCANinvertabinarytree!Inpu
zhang35
·
2020-08-05 21:17
PAT
PAT甲级
1087. All Roads Lead to Rome (30) (dijkstra)
题目链接:传送门思路:直接dijkstra即可,在过程中记录路径并转移各种情况,似乎先dijkstra记录路径再dfs比较好写。。但是我之前并没有想到这种题因为dijkstra以贪心选择选取最近的点,只排除了不可能成为最短路的情况,有可能构成最短路的所有情况并没有被跳过,所以模拟即可代码:#includeusingnamespacestd;constintmaxn=205;structnode{i
一只谜谜怪
·
2020-08-05 19:19
pat甲级
最短路
PAT甲级
1114 Family Property (25分) (并查集)
题目链接:传送门思路:根据题意首先把所有给出的人记录下来,包括n个id,还有n个id对应的父母和孩子(可能没有房产信息,但需要在求平均的时候占人数),我这里使用结构体存的,没有信息的人的房产信息默认为零,只记录id,(也可以不这样存储,用一个标记数组标记人是否存在也行),然后扫一遍寻找所有家庭,假设此时家庭成员的都满足p[i]=t,则都存在一个ans[t]这个vector数组中,并且把t存储在集合
一只谜谜怪
·
2020-08-05 19:19
并查集
stl
PAT甲级
1107 Social Clusters (30分)(并查集)
题目描述:传送门思路:题目中要求只要两个人有任意相同兴趣,那么他们就能被分到一组,于是可以记录每种兴趣对应的人(兴趣可以对应多个人,但是这里随便记录就行,只要有就可以之后进行合并了),之后遍历每个人的兴趣,根据兴趣对应的人合并即可,具体请参考代码。代码:#includeusingnamespacestd;constintmaxn=1005;intans[maxn];intcnt[maxn];int
一只谜谜怪
·
2020-08-05 19:19
pat甲级
并查集
PAT甲级
1136A Delayed Palindrome
题目链接https://pintia.cn/problem-sets/994805342720868352/problems/994805345732378624题解一英语notation标记法palindromic回文的palindrome回文bepairedwith与……配对思路、注意点和代码要实现回文数判断要实现字符串逆序整体思路就是题目描述的那样:判断是不是回文数,不是的话就逆序后和原数相
臭咸鱼
·
2020-08-05 15:00
2017年9月17日
PAT甲级
考试反思
2017年9月17日
PAT甲级
考试反思前天跑河南中医药大学考试,早上九点多出发的,碰上地铁大检查,堵二七地铁站一个多小时,十一点多才到达河中医。
whl_program
·
2020-08-05 03:53
PAT甲级
PAT甲级
题目对应知识点分类梳理
PAT甲级
的106道题的知识点与对应的题号整理如下,便于做专项练习和巩固!
小哈里
·
2020-08-05 01:22
NOIP
PAT甲级
1140Look-and-say Sequence
题目链接https://pintia.cn/problem-sets/994805342720868352/problems/994805344490864640题解一英语correspondingto与…相一致,我之前似乎记成了“根据……”思路、注意点和代码题目:第n+1个数字是第n个数字的一种描述第n+1个串是第n个串中各个数字的统计统计规则是不好描述,我就不描述了。看样例或者代码就能看出来了
臭咸鱼
·
2020-08-04 21:00
PAT甲级
1151 LCA in a Binary Tree LCA+DFS
LCA问题在常规树中的实现,思路和1143一样,本体主要要解决的就是递归子树边界的问题我采用的map映射的方法,将中序遍历的结点值映射为下标位置,那么如果用下标来代替结点值的话,当前的树便是一颗bst树了利用这个特性,比较映射值便可以判断左右子树的关系#include#include#include#includeusingnamespacestd;vectorpre,in;unordered_m
哦啦哦啦!
·
2020-08-04 21:36
PAT甲级
PAT甲级
1107 Social Clusters 1、4样例没过解析
观察样例,发现A、B、C三人,即使A和C并没有共同爱好,但他们和B都有共同爱好,所以他们也属于同一个集合因此我考虑将有关联的爱好捆绑在一起:合并一个人的所有爱好,只要A和B的爱好有交集,那么他们的所有爱好都会被绑定到一个集合中统计人数时,取每个人的第一个爱好(题目保证每个人至少一个爱好),找到该爱好所属的集合的根,将根的值放入result,累加一次num[r];最后将每个集合对应的人数放入out,
哦啦哦啦!
·
2020-08-04 21:36
PAT甲级
PAT甲级
1143 Lowest Common Ancestor BST+LCA
本想建树然后通过递归左右子树的形式去做,但是发现题中说明最多有一万个结点,写完以后果然超时....判别LCA的方法判断当前的两个点的位置情况,如果一个在左子树,一个在右子树,那么根便是最小公共祖先;如果都在左子树,递归左子树判断;如果都在右子树,递归右子树判断;如果一个就是根,那么它便是最小公共祖先解决超时方法:由于题目告知是bst树,其实只需要比较结点值便可以确定左右子树的关系。但是递归时根结点
哦啦哦啦!
·
2020-08-04 21:35
PAT甲级
PAT甲级
1152Google Recruitment
题目链接https://pintia.cn/problem-sets/994805342720868352/problems/1071785055080476672题解涉及到的英语知识recruitment招聘thefirst10-digitprimefoundinconsecutivedigitsofthenaturalconstante由自然常数e的连续数字中的第一个10位素数prime素数c
臭咸鱼
·
2020-08-04 20:00
PAT甲级
供应商问题 1079 1090 1106
供应商问题(dfs)1079TotalSalesofSupplyChain(25分)题目描述Asupplychainisanetworkofretailers(零售商),distributors(经销商),andsuppliers(供应商)--everyoneinvolvedinmovingaproductfromsuppliertocustomer.Startingfromonerootsupp
October's very own
·
2020-08-04 17:15
PAT
树结构
dfs
PAT甲级
1052
1052.LinkedListSorting(25)时间限制400ms内存限制65536kB代码长度限制16000B判题程序Standard作者CHEN,YueAlinkedlistconsistsofaseriesofstructures,whicharenotnecessarilyadjacentinmemory.Weassumethateachstructurecontainsaninteg
strivinging
·
2020-08-04 16:05
PAT
Digital Library (30)-
PAT甲级
1022.DigitalLibrary(30)ADigitalLibrarycontainsmillionsofbooks,storedaccordingtotheirtitles,authors,keywordsoftheirabstracts,publishers,andpublishedyears.Eachbookisassignedanunique7-digitnumberasitsID.
柳婼
·
2020-08-04 15:53
PAT
Digital Library (30)-
PAT甲级
真题(map映射)
ADigitalLibrarycontainsmillionsofbooks,storedaccordingtotheirtitles,authors,keywordsoftheirabstracts,publishers,andpublishedyears.Eachbookisassignedanunique7-digitnumberasitsID.Givenanyqueryfromareade
柳婼
·
2020-08-04 15:53
PAT
PAT
Reversing Linked List (25)-
PAT甲级
真题
GivenaconstantKandasinglylinkedlistL,youaresupposedtoreversethelinksofeveryKelementsonL.Forexample,givenLbeing1→2→3→4→5→6,ifK=3,thenyoumustoutput3→2→1→6→5→4;ifK=4,youmustoutput4→3→2→1→5→6.InputSpecifi
柳婼
·
2020-08-04 15:22
PAT
1022 Digital Library (30 分)--
PAT甲级
1022DigitalLibrary(30分)ADigitalLibrarycontainsmillionsofbooks,storedaccordingtotheirtitles,authors,keywordsoftheirabstracts,publishers,andpublishedyears.Eachbookisassignedanunique7-digitnumberasitsID.
NullObjectError
·
2020-08-04 15:24
PAT
【
PAT甲级
】1074. Reversing Linked List (25)
直接用一个矩阵order存储节点地址,再这个矩阵上进行翻转,不知道算不算投机取巧#include#includeusingnamespacestd;structNode{inte;intnext;};Nodelist[100000];voidswap(int*a,inti,intj);intmain(){intstart,len,k;cin>>start>>len>>k;for(inti=0;i>
lambsnow
·
2020-08-04 15:46
PAT
【算法每日一练】
PAT甲级
1052 java
Alinkedlistconsistsofaseriesofstructures,whicharenotnecessarilyadjacentinmemory.WeassumethateachstructurecontainsanintegerkeyandaNextpointertothenextstructure.Nowgivenalinkedlist,youaresupposedtosortt
梓莘
·
2020-08-04 13:59
算法每日一练
浙大
PAT甲级
-1022
关键点:(1)cin输入并没有将换行符输入所以后面如果紧接着getline(cin,str)需先输入完换行符(2)ID打印注意前面补零(%07d)(否则后面两个测试点过不去)#include#include#include#include#includeusingnamespacestd;structbook{intid;stringtitle;stringauthor;vectorkeyword
zbyue_
·
2020-08-04 12:21
浙大PAT甲级练习题
PAT甲级
技巧总结(一)
编程思路、技巧总结1.判断堆是大顶堆还是小顶堆2.深度遍历堆3.判断是否为素数4.最低公共祖先5.判断环和简单路径(环)6.完全二叉树叶子结点、非叶子结点个数7.完全二叉树层次遍历——堆,判断是大顶堆还是小顶堆的第二种方法8.测试序列是否为拓扑序列9.哈希表1.判断堆是大顶堆还是小顶堆inta[1009],isMin=1,isMax=1;//数组a存储堆(完全二叉树),第一个节点的索引为1//is
星殇丶
·
2020-08-03 08:51
PAT甲级刷题经验总结
PAT甲级
技巧总结(二)
编程思路、技巧总结1.排序思想总结2.使用哈希表代替邻接表3.判断回文串4.将两个相同位数的字符串作为数字进行相加5.链表问题6.异常7.根结点8.对结构体进行排序1.排序思想总结最终呈现一个数据及其多个属性的时候可以考虑每个属性使用一个map(或unordered_map)来存储。最后对所有数据进行一次顺序排序:vectorans;intrank=0,pres=-1;//rank用于标识序号,p
星殇丶
·
2020-08-03 08:51
PAT甲级刷题经验总结
PAT甲级
1002 A+B for Polynomials (25分)(一堆坑)
Thistime,youaresupposedtofindA+BwhereAandBaretwopolynomials.InputSpecification:Eachinputfilecontainsonetestcase.Eachcaseoccupies2lines,andeachlinecontainstheinformationofapolynomial:KN1aN1N2aN2…NKaNKw
Fmm-PMO
·
2020-08-03 08:12
PAT甲级
PAT甲级
刷题记录——1002 A+B for Polynomials (25分)
Thistime,youaresupposedtofindA+BwhereAandBaretwopolynomials.InputSpecification:Eachinputfilecontainsonetestcase.Eachcaseoccupies2lines,andeachlinecontainstheinformationofapolynomial:KN1aN1N2aN2…NKaNKw
囷囷
·
2020-08-03 07:53
PAT甲级
【
PAT甲级
】1002 A+B for Polynomials (25分)
1002A+BforPolynomials(25分)Thistime,youaresupposedtofindA+BwhereAandBaretwopolynomials.InputSpecification:Eachinputfilecontainsonetestcase.Eachcaseoccupies2lines,andeachlinecontainstheinformationofapol
韩旭051
·
2020-08-02 20:36
PAT甲级练习题
2020春季(7月)
PAT甲级
考试题解
2020春季(7月)
PAT甲级
考试题解7-1PrimeDay(20分)TheabovepictureisfromSinaWeibo,showingMay23rd,2019asaverycool“PrimeDay
FWFJH
·
2020-07-30 13:15
2020年7月
pat甲级
第二题
7-2TheJudger(25分)Agameofnumbershasthefollowingrules:atthebeginning,twodistinctpositiveintegersaregivenbythejudge.Theneachplayerinturnmustgiveanumbertothejudge.Thenumbermustbethedifferenceoftwonumberst
诗爷酱
·
2020-07-30 12:57
PAT甲级
A1075 PAT Judge (25 分)
TheranklistofPATisgeneratedfromthestatuslist,whichshowsthescoresofthesubmissions.ThistimeyouaresupposedtogeneratetheranklistforPAT.InputSpecification:Eachinputfilecontainsonetestcase.Foreachcase,thefi
小·幸·运
·
2020-07-30 12:06
PAT甲级
排序
2020
PAT甲级
春季考试题目及解答
总结:按这个出题的风格,历年的题应该没啥常考价值了,没有模板题,都得靠平时编码积累。7-1PrimeDay(20分)TheabovepictureisfromSinaWeibo,showingMay23rd,2019asaverycool“PrimeDay”.Thatis,notonlythatthecorrespondingnumberofthedate20190523isaprime,buta
Berlin丶
·
2020-07-30 12:54
PAT刷题笔记
PAT
20200725
PAT甲级
7-2 The Judger (25分)
#include#include#includeusingnamespacestd;intexist[100010]={0},diff[100010]={0};//exist记录已经报过的数,diff记录已经报过的数的差值vectorexists;//exists记录已经报过的数,对于每个新报的数,和每个已存的数相减得差intht[15]={0};inta[1010][1010];intmain(
gingerCat1123
·
2020-07-30 12:42
PAT甲级
2020年7月第3题
PAT甲级
真题 Safari Park (25分)
Asafaripark(野生动物园)hasKspeciesofanimals,andisdividedintoNregions.Themanagershopetospreadtheanimalstoalltheregions,butnotthesameanimalsinthetwoneighboringregions.Ofcourse,theyalsorealizethatthisisanNPco
浒鱼鱼
·
2020-07-30 11:21
PAT甲级
【
PAT甲级
】排序题专题复习
固定模式要排序的量一般放在一个或多个向量的结构体、unordered_map或者set中,然后定义一个或多个cmp函数。(具体是几个就看题目将排序对象分成几种、有几个判断依据)。坑点1.最好直接用unordered_map代替map,就不会有查询超时2.题目的要求都会有测试点,所以要好好读题,归纳出每种情况,想好再写,代码的复杂度其实不高的普通题库(1001-1136)1012TheBestRan
浒鱼鱼
·
2020-07-30 11:21
PAT甲级
2020年7月第4题
PAT甲级
真题 Replacement Selection (30分)
Whentheinputismuchtoolargetofitintomemory,wehavetodoexternalsortinginsteadofinternalsorting.Oneofthekeystepsinexternalsortingistogeneratesetsofsortedrecords(alsocalledruns)withlimitedinternalmemory.Th
浒鱼鱼
·
2020-07-30 11:21
PAT甲级
2020年7月第1题
PAT甲级
真题 Prime Day (20分)
TheabovepictureisfromSinaWeibo,showingMay23rd,2019asaverycool"PrimeDay".Thatis,notonlythatthecorrespondingnumberofthedate20190523isaprime,butallitssub-stringsendedatthelastdigit3areprimenumbers.Nowyou
浒鱼鱼
·
2020-07-30 11:21
PAT甲级
【
PAT甲级
】1129 Recommendation System (25) 优化过的代码很简单
致谢:https://blog.csdn.net/liuchuo/article/details/68912867liuchuo代码的结构体初始化时的构造函数:node(inta,intb):value(a),cnt(b){}可以省略,我作了以下改动,也是满分代码。因为代码很简单,我在注释中注明注意事项。#include#include#includeusingnamespacestd;intbo
浒鱼鱼
·
2020-07-30 11:21
PAT甲级
2019年9月8日秋季
PAT甲级
题解-2-1161-Merging Linked Lists (25 分) 双解法
GiventwosinglylinkedlistsL1=a1→a2→⋯→an−1→anandL2=b1→b2→⋯→bm−1→bm.Ifn≥2m,youaresupposedtoreverseandmergetheshorteroneintothelongeronetoobtainalistlikea1→a2→bm→a3→a4→bm−1⋯.Forexample,givenonelistbeing6→
浒鱼鱼
·
2020-07-30 11:20
PAT甲级
2019年9月8日秋季
PAT甲级
题解-4 Dijkstra Sequence (30 分) 详细分析
Dijkstra'salgorithmisoneoftheveryfamousgreedyalgorithms.Itisusedforsolvingthesinglesourceshortestpathproblemwhichgivestheshortestpathsfromoneparticularsourcevertextoalltheotherverticesofthegivengraph.
浒鱼鱼
·
2020-07-30 11:20
PAT甲级
数据结构
算法
c++
PAT甲级
——PAT Judge
题目描述TheranklistofPATisgeneratedfromthestatuslist,whichshowsthescoresofthesubmittions.ThistimeyouaresupposedtogeneratetheranklistforPAT.输入描述:Eachinputfilecontainsonetestcase.Foreachcase,thefirstlinecon
Xiao2018428
·
2020-07-30 11:10
PAT
2020年7月第2题
PAT甲级
真题 The Judger (25分)
Agameofnumbershasthefollowingrules:atthebeginning,twodistinctpositiveintegersaregivenbythejudge.Theneachplayerinturnmustgiveanumbertothejudge.Thenumbermustbethedifferenceoftwonumbersthatarepreviouslyg
浒鱼鱼
·
2020-07-30 11:13
PAT甲级
PAT甲级
——1110 Complete Binary Tree (完全二叉树)
1110CompleteBinaryTree(25分)Givenatree,youaresupposedtotellifitisacompletebinarytree.InputSpecification:Eachinputfilecontainsonetestcase.Foreachcase,thefirstlinegivesapositiveintegerN(≤20)whichisthetot
Little Panda
·
2020-07-30 10:04
PAT
(Advanced
Level)
Practice
数据结构与算法
PAT甲级
-1064 Complete Binary Search Tree(30分)
PAT甲级
-1064CompleteBinarySearchTree(30分)1064CompleteBinarySearchTree(30分)ABinarySearchTree(BST)isrecursivelydefinedasabinarytreewhichhasthefollowingproperties
aiFee
·
2020-07-30 10:45
PAT甲级
MOOC数据结构-陈越姥姥
pat甲级
1064-Complete Binary Search Tree
欢迎访问我的
pat甲级
题解目录哦https://blog.csdn.net/richenyunqi/article/details/84981078题目描述题意分析给定一组序列,求出由该序列构成的完全二叉查找树的层次遍历序列
日沉云起
·
2020-07-30 09:13
pat甲级
PAT甲级
1064 Complete Binary Search Tree (30 分)
1064CompleteBinarySearchTree(30分)ABinarySearchTree(BST)isrecursivelydefinedasabinarytreewhichhasthefollowingproperties:Theleftsubtreeofanodecontainsonlynodeswithkeyslessthanthenode'skey.Therightsubtre
番茄杀手Dexter
·
2020-07-30 09:44
PAT甲级
PAT甲级
1070 Mooncake
MooncakeisaChinesebakeryproducttraditionallyeatenduringtheMid-AutumnFestival.Manytypesoffillingsandcrustscanbefoundintraditionalmooncakesaccordingtotheregion’sculture.Nowgiventheinventoryamountsandthe
写完这道题就睡觉
·
2020-07-30 09:57
PAT
OJ试题
PAT 甲级 1049(30 分)
PAT甲级
1049(30分)题目Thetaskissimple:givenanypositiveintegerN,youaresupposedtocountthetotalnumberof1’sinthedecimalformoftheintegersfrom1toN.Forexample
努力不脱发的程序媛
·
2020-07-30 09:51
PAT
上一页
9
10
11
12
13
14
15
16
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他