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甲级
刷题之路——1074
有点像今年秋季的
PAT甲级
的第二题,说多了都是泪呀PAT1074ReversingLinkedList原题如下GivenaconstantKandasinglylinkedlistL,youaresupposedtoreversethelinksofeveryKelementsonL.Forexample
乱八七糟的小白
·
2020-08-21 05:17
PAT甲级刷题之路
2020年7月
PAT甲级
真题 Replacement Selection
题目题意:外排的选择替换算法模拟tips:模拟+优先队列注:非满分版本,当时考试被陈姥姥卡在最后一个测试点超时了#include#include#include#includeusingnamespacestd;intmain(){intn,k;cin>>n>>k;vectorans(n);for(inti=0;itemp;priority_queue,greater>q;vectorans1;i
江楚郎(张文哲
·
2020-08-21 05:07
练习
2020年7月
PAT甲级
真题 The Judger
题目题意:首先给出两个数字,然后n名选手,m轮比赛,每轮比赛n名选手分别给出自己的数字,数字要求不能与前面出现过的重复,并且必须是前面出现的任意两个数之差,否则直接在第i轮比赛淘汰第j名选手,被淘汰的选手的后面比赛的数字直接忽略,最后升序输出胜出者。tips:set+模拟#include#include#includeusingnamespacestd;intmain(){inta,b;cin>>
江楚郎(张文哲
·
2020-08-21 05:07
练习
2020年7月
PAT甲级
真题 Safari Park
题目题意:动物园的动物数小于等于区域数,判断放置的方案能不能满足相邻的区域没有同一种动物。tips:模拟#include#include#include#includeusingnamespacestd;intmain(){intn,r,k;cin>>n>>r>>k;map>ans;for(inti=0;i>a>>b;ans[a].push_back(b);ans[b].push_back(a);
江楚郎(张文哲
·
2020-08-21 05:07
练习
2020年7月
PAT甲级
真题 Prime Day
题目题意:判断给出的时间字符串及其子串是否全是素数tips:素数判断+字符串处理#include#include#includeusingnamespacestd;boolprime(intn){if(n==1||n==0)returnfalse;if(n==2)returntrue;for(inti=2;i>n;intans;while(n.size()>1){intans=0;stringte
江楚郎(张文哲
·
2020-08-21 05:07
练习
浙大
PAT甲级
1074
刚开始输入时用map将id与node结构体相互映射,用vector来保存链表,然后根据除法与取余来判断是否有不番转的项。AC代码:#include#include#include#include#include#include#include#include#include#include#include#defineinf999999999usingnamespacestd;structnode
luowei5513
·
2020-08-21 04:55
浙大pat
PAT甲级
练习1074. Reversing Linked List (25)
1074.ReversingLinkedList(25)时间限制400ms内存限制65536kB代码长度限制16000B判题程序Standard作者CHEN,YueGivenaconstantKandasinglylinkedlistL,youaresupposedtoreversethelinksofeveryKelementsonL.Forexample,givenLbeing1→2→3→4→
a1025461748
·
2020-08-21 03:09
PAT甲级练习
PAT甲级
1074,1075解题报告
1074ReversingLinkedList(25point(s))GivenaconstantKandasinglylinkedlistL,youaresupposedtoreversethelinksofeveryKelementsonL.Forexample,givenLbeing1→2→3→4→5→6,ifK=3,thenyoumustoutput3→2→1→6→5→4;ifK=4,yo
Tate_Brown
·
2020-08-21 03:48
C++
PAT
C
Reversing Linked List (25)
PAT甲级
甲级传送门乙级传送门#include#includeusingnamespacestd;#defineMAX_N100100structNode{intaddress;intnext;intdata;intorder;}node[MAX_N];boolcmp(structNodea,structNodeb){returna.orderi*k;j--){printf("%05d%d%05d\n",n
老虞面馆
·
2020-08-21 03:04
PAT
甲级
PAT
乙级
PAT甲级
(1074)
只做到了24分最后一个数据点没通过,但个人感觉比柳神的更容易理解。1、首先将原始链加入v;2、先算出分组g=n/k,对g个分组进行逆置加入ans,将剩下的n%k原顺序输出加入ans;#includeusingnamespacestd;structnode{intid,val,next;}a[100010];vectorv,ans;intmain(){intstart,n,k;scanf("%d%d
coder鹏鹏
·
2020-08-21 02:05
PAT
甲级
PAT甲级
1074 【Reversing Linked List (25)】
在王道书上看到了逆转的好方法,要注意Reverse函数数组下标的确定。本菜因为混用cout和printf导致一直WA。。。留下了没有技术的泪水,虽然代码写得非常搓,还是记录下自己的错误。#include#includeusingnamespacestd;constintmaxn=1e6+10;structNode{intaddr;intdata;intnext;}node[maxn],mynode
gq97
·
2020-08-21 02:44
错误提醒
PAT
链表
反转
C++
PAT甲级
真题 1111 Online Map (30分) C++实现(两次dijkstra+dfs,复用封装函数)
题目Inputourcurrentpositionandadestination,anonlinemapcanrecommendseveralpaths.Nowyourjobistorecommendtwopathstoyouruser:oneistheshortest,andtheotheristhefastest.Itisguaranteedthatapathexistsforanyreque
zhang35
·
2020-08-19 22:52
PAT
PAT甲级
真题 1113 Integer Set Partition (25分) C++实现 (简单划分数组)
题目GivenasetofN(>1)positiveintegers,youaresupposedtopartitionthemintotwodisjointsetsA1andA2ofn1andn2numbers,respectively.LetS1andS2denotethesumsofallthenumbersinA1andA2,respectively.Youaresupposedtomak
zhang35
·
2020-08-19 22:52
PAT
PAT甲级
真题 1112 Stucked Keyboard (20分) C++实现(键盘坏键问题)
题目Onabrokenkeyboard,someofthekeysarealwaysstucked.Sowhenyoutypesomesentences,thecharacterscorrespondingtothosekeyswillappearrepeatedlyonscreenforktimes.Nowgivenaresultingstringonscreen,youaresupposedt
zhang35
·
2020-08-19 22:52
PAT
PAT甲级
真题 1110 Complete Binary Tree (25分) C++实现(判断完全二叉树)
题目Givenatree,youaresupposedtotellifitisacompletebinarytree.InputSpecification:Eachinputfilecontainsonetestcase.Foreachcase,thefirstlinegivesapositiveintegerN(≤20)whichisthetotalnumberofnodesinthetree–
zhang35
·
2020-08-19 22:52
PAT
PAT A1101 Quick Sort
1101.QuickSort(25)-
PAT甲级
真题Thereisaclassicalprocessnamedpartitioninthefamousquicksortalgorithm.Inthisprocesswetypicallychooseoneelementasthepivot.Thentheelementslessthanthepivotaremovedtoitsleftandthos
Mr.小豆丁
·
2020-08-19 22:33
pat甲级
算法导论
PAT甲级
1122 Hamiltonian Cycle (25 分)
1122HamiltonianCycle(25分)The"Hamiltoncycleproblem"istofindasimplecyclethatcontainseveryvertexinagraph.Suchacycleiscalleda"Hamiltoniancycle".Inthisproblem,youaresupposedtotellifagivencycleisaHamiltonia
番茄杀手Dexter
·
2020-08-19 03:36
PAT甲级
PAT甲级
真题 1059 Prime Factors (25分) C++实现(建立素数备忘录)
题目GivenanypositiveintegerN,youaresupposedtofindallofitsprimefactors,andwritethemintheformatN=p1^k1*p2^k2*…*pm^km.InputSpecification:EachinputfilecontainsonetestcasewhichgivesapositiveintegerNintherang
zhang35
·
2020-08-18 07:43
PAT
1059.Prime Factors (25)...to be continued...
1059.PrimeFactors(25)…tobecontinued…pat-al-10592017-02-27参考:1059.PrimeFactors(25)-
PAT甲级
真题(素数表的建立)原来还可以这样建立素数表
风怜目尽无疆地s
·
2020-08-18 07:10
pat
[
PAT甲级
]1013. Battle Over Cities (25)(图的遍历,统计强连通分量个数)
1013.BattleOverCities(25)原题链接Itisvitallyimportanttohaveallthecitiesconnectedbyhighwaysinawar.Ifacityisoccupiedbytheenemy,allthehighwaysfrom/towardthatcityareclosed.Wemustknowimmediatelyifweneedtorepai
whl_program
·
2020-08-18 06:47
PAT甲级
PAT甲级
1013
Battle
Over
Cities
PAT甲级
刷题记录——1059 Prime Factors (25分)
GivenanypositiveintegerN,youaresupposedtofindallofitsprimefactors,andwritethemintheformatN=p1k1×p2k2×⋯×pmkm.InputSpecification:EachinputfilecontainsonetestcasewhichgivesapositiveintegerNintherangeoflo
囷囷
·
2020-08-18 05:41
PAT甲级
pat甲级
1049 Counting Ones (30 分)
欢迎访问我的
pat甲级
题解目录哦https://blog.csdn.net/richenyunqi/article/details/84981078题目描述算法设计显然暴力枚举的方法是不可取的,我们需要寻找其中的规律
日沉云起
·
2020-08-18 02:43
pat甲级
pat甲级
1059. Prime Factors (25)
欢迎访问我的
pat甲级
题解目录哦https://blog.csdn.net/richenyunqi/article/details/84981078题目描述算法设计这道题要求求出给定整数N的质因子。
日沉云起
·
2020-08-18 02:43
pat甲级
PAT甲级
1105 Spiral Matrix (25分)
题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805363117768704思路:1.将所给序列倒序排序;2.一圈一圈地将序列逆时针填入矩阵;我的思路是使用变量x,y来表示当前我们所需操作的矩阵位置,然后按如下顺序挨个填入数据;重点是对x,y坐标位置的控制;代码:#includeusingnamespacest
Yuhan の Blog
·
2020-08-18 02:07
PAT
(Advanced
Level)
Practice
PAT甲级
1026 Table Tennis (30分)
题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805472333250560思路:据说现在PAT已经不考这种大模拟了,准备PAT的同学可以酌情跳过节省时间~我的想法是用优先队列保存即将要发生的事件(一共三种事件),先发生的排在前面。用户排队的情况我是使用两个队列分别存储vip和普通用户的。接下来我们一个一个处理
Yuhan の Blog
·
2020-08-18 02:37
PAT
(Advanced
Level)
Practice
PAT甲级
1106 Lowest Price in Supply Chain (25分)
题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805362341822464思路:1.考察树的dfs;2.零售商只可能在叶子节点,若从root到零售商所经历的边的数量为aaa,则该零售商的价格就是p∗(1+r∗0.01)ap*(1+r*0.01)^ap∗(1+r∗0.01)a;代码:#includeusingn
Yuhan の Blog
·
2020-08-18 02:37
PAT
(Advanced
Level)
Practice
PAT甲级
1049 Counting Ones (30 分)
Thetaskissimple:givenanypositiveintegerN,youaresupposedtocountthetotalnumberof1’sinthedecimalformoftheintegersfrom1toN.Forexample,givenNbeing12,therearefive1’sin1,10,11,and12.InputSpecification:Eachin
写完这道题就睡觉
·
2020-08-18 01:17
PAT
OJ试题
PAT甲级
1059 Prime Factors
想法:这道题要找质因子,所以首先把2到100000左右的质数全找出来,利用素数筛法。经过分析可知,一个数n的质因子要么全小于根号下n,或存在一个大于根号下n的因子,因此可以缩小搜索范围。#include#include#include#include#include#include#include#include#includeusingnamespacestd;intprime[100005];
zx234
·
2020-08-18 01:34
Prime Factors (25)-
PAT甲级
真题
1059.PrimeFactors(25)GivenanypositiveintegerN,youaresupposedtofindallofitsprimefactors,andwritethemintheformatN=p1^k1*p2^k2*…*pm^km.InputSpecification:Eachinputfilecontainsonetestcasewhichgivesapositi
邪恶牛犊
·
2020-08-18 01:21
PAT甲级
PAT甲级
1059 Prime Factors (25 分)素数表的建立
1059PrimeFactors(25分)GivenanypositiveintegerN,youaresupposedtofindallofitsprimefactors,andwritethemintheformatN=p1k1×p2k2×⋯×pmkm.InputSpecification:Eachinputfilecontainsonetestcasewhichgivesapositivei
love music.
·
2020-08-18 00:01
PAT
PAT
PAT甲级
1059
1059.PrimeFactors(25)时间限制100ms内存限制65536kB代码长度限制16000B判题程序Standard作者HE,QinmingGivenanypositiveintegerN,youaresupposedtofindallofitsprimefactors,andwritethemintheformatN=p1^k1*p2^k2*…*pm^km.InputSpecifi
strivinging
·
2020-08-18 00:40
PAT
1059 Prime Factors (25分)--
PAT甲级
真题
题目大意:输入一个正整数,要求输出该正整数的素数分解因素,并按照要求格式输出;分析:首先用素数筛选法找出一定范围内的所有素数,然后按照从小到达的顺序,对该正整数进行素数分解;那么筛选素数的范围到底要多大呢?该题中正整数N的范围是longint(-2147483648~2147483647),素数只要筛选到100000即可,因为1000002>2147483647,如果分解后的部分不能被100000
SamsonKun
·
2020-08-18 00:12
PAT
浙大
PAT甲级
1059
分解因式题,可先筛选素数,再进行遍历判断。AC代码:#include#include#include#include#include#include#include#include#include#include#includeusingnamespacestd;intmark[100000];intprime[100000];intnum=0;voidinit(){for(longlongi=2
luowei5513
·
2020-08-17 23:29
浙大pat
2019-02-15 PAT 甲级 1056-1059刷题感受
2019-02-15
PAT甲级
1056-1059刷题感受题目分值得分1056250105730171058202010592525总分10062做了很长时间,发现时间不够了。
Kibbo
·
2020-08-17 23:17
PAT
Median (25)-
PAT甲级
真题(two points)
GivenanincreasingsequenceSofNintegers,themedianisthenumberatthemiddleposition.Forexample,themedianofS1={11,12,13,14}is12,andthemedianofS2={9,10,15,16,17}is15.Themedianoftwosequencesisdefinedtobethemed
柳婼
·
2020-08-17 23:40
PAT
PAT甲级
1059. Prime Factors (25)
GivenanypositiveintegerN,youaresupposedtofindallofitsprimefactors,andwritethemintheformatN=p1^k1*p2^k2*…*pm^km.InputSpecification:EachinputfilecontainsonetestcasewhichgivesapositiveintegerNintherangeo
liaotl10
·
2020-08-17 23:42
PAT甲级
PAT甲级
1049. Counting Ones (30)
Thetaskissimple:givenanypositiveintegerN,youaresupposedtocountthetotalnumberofonesinthedecimalformoftheintegersfrom1toN.Forexample,givenNbeing12,therearefiveonesin1,10,11,and12.InputSpecification:Each
liaotl10
·
2020-08-17 23:42
PAT甲级
PAT甲级
1002 All Roads Lead to Rome
AllRoadsLeadtoRome(30)时间限制1000ms内存限制65536KB代码长度限制100KB判断程序Standard(来自小小)题目描述IndeedtherearemanydifferenttouristroutesfromourcitytoRome.Youaresupposedtofindyourclientstheroutewiththeleastcostwhilegainin
hei_hei_hei_
·
2020-08-17 22:12
PAT甲级
PAT甲级
1152~1155
1152GoogleRecruitment(20分)InJuly2004,GooglepostedonagiantbillboardalongHighway101inSiliconValley(showninthepicturebelow)forrecruitment.Thecontentissuper-simple,aURLconsistingofthefirst10-digitprimefou
hei_hei_hei_
·
2020-08-17 22:12
PAT甲级
PAT甲级
1001 Public Bike Management
PublicBikeManagement(30)时间限制1000ms内存限制65536KB代码长度限制100KB判断程序Standard(来自小小)题目描述ThereisapublicbikeserviceinHangzhouCitywhichprovidesgreatconveniencetothetouristsfromallovertheworld.Onemayrentabikeatanys
hei_hei_hei_
·
2020-08-17 22:12
PAT甲级
PAT甲级
1059. Prime Factors (25)
题目:GivenanypositiveintegerN,youaresupposedtofindallofitsprimefactors,andwritethemintheformatN=p1^k1*p2^k2*…*pm^km.InputSpecification:EachinputfilecontainsonetestcasewhichgivesapositiveintegerNintheran
知了声日迟
·
2020-08-17 21:13
PAT甲级练习题
PAT甲级
1058,1059
1058A+BinHogwarts(20point(s))IfyouareafanofHarryPotter,youwouldknowtheworldofmagichasitsowncurrencysystem--asHagridexplainedittoHarry,"SeventeensilverSicklestoaGalleonandtwenty-nineKnutstoaSickle,it's
Tate_Brown
·
2020-08-17 20:24
C++
PAT
C
PAT甲级
1012 The Best Rank
需要注意的问题是并列第二都是第二名,所以单纯的排序时,并列第二所在位置是第二和第三,所以还需要处理。#include#include#include#includeusingnamespacestd;#defineINF0x3f3f3f3fcharbestone[2005];intbest[2005];typedefstructstudent{intid;intc;intm;inte;inta;i
Q_000
·
2020-08-17 20:07
PAT甲级
PAT甲级
1025 PAT Ranking
#include#include#include#includeusingnamespacestd;typedefstructnodee{chara[20];intgrade;intln;intlr;intfr;}node;nodet[30005];intn;boolcmp(nodep1,nodep2){if(p1.grade!=p2.grade)returnp1.grade>p2.grade;e
Q_000
·
2020-08-17 20:07
PAT甲级
PAT甲级
1030 Travel Plan
算法是dijkstra,可以不用DFS,在计算的时候同步更新边的cost和weight,然后将最短路存在vector里面就可以了,相对比较简单#include#include#includeusingnamespacestd;#defineINF0x3f3f3f3fintloadw[505][505];intloadc[505][505];intloadsumw[505];intloadsumc[
Q_000
·
2020-08-17 20:07
PAT甲级
PAT甲级
1075 PAT Judge
情况不少需要好好分析#include#include#include#includeusingnamespacestd;intn,k,m;intper_rank[5];typedefstructstudent{intid;intscore[5];intscore_f[5];inttotal_score;inttotal_solve;intrank;intflag=0;}stu;stus[10005
Q_000
·
2020-08-17 20:07
PAT甲级
PAT甲级
1015 Reversible Primes
素数判断+进制转换。由于有多个case,素数判断可以写个筛法。进制转换前面几题也有出现过,不多说了。翻转字符串,对于char[],可以用strrev(s);对于string,可以用reverse(s.begin(),s.end())。当然,自己写也ok。#includeusingnamespacestd;constintmaxn=1e5+5;intn,d;intprimeList[maxn],cn
坤斤拷
·
2020-08-17 19:27
PAT甲级题解
PAT甲级
1017 Queueing at Bank
姥姥的银行又开业了。跟1014相比,简单了不少,只需要找到最早可用的窗口即可。但我还是卡了半天,读题不认真。。。PAT真就考读题。我卡了半天的点是,17:00(含)前到的客户,无论多晚,银行都奉陪到底,这是我意想不到的。。。#include#defineINF0x3f3f3f3fusingnamespacestd;constintmaxn=1e4+4;constintmaxk=1e2+2;cons
坤斤拷
·
2020-08-17 19:27
PAT甲级题解
PAT甲级
1016 Phone Bills
大模拟。关键点在于:排序。各个record的顺序和各个客户的bill的顺序,需要处理,都可以通过string的on-line,会是正数,反之会是负数。具体的看代码吧#includeusingnamespacestd;constintmaxn=1e3+3;intrates[24];intallHourCost[24];intallDayCost;structRecord{stringdate;str
坤斤拷
·
2020-08-17 19:27
PAT甲级题解
PAT甲级
1014 Waiting in Line
模拟题。感觉跟某次CSP的第四题有点像,是它的简化版。维护n个队列,长度均usingnamespacestd;constintmaxn=20+2;constintmaxk=1e3+3;constintmaxt=540;structWindow{intnext;//下一个客户可以开始处理的时间dequeline;//队列voidpush_back(intx){line.push_back(x);}v
坤斤拷
·
2020-08-17 19:27
PAT甲级题解
上一页
4
5
6
7
8
9
10
11
下一页
按字母分类:
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
其他