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甲级
-1010. Radix (25)进制
1010.Radix(25)时间限制400ms内存限制65536kB代码长度限制16000B判题程序Standard作者CHEN,YueGivenapairofpositiveintegers,forexample,6and110,canthisequation6=110betrue?Theansweris"yes",if6isadecimalnumberand110isabinarynumber
kewlgrl
·
2020-08-09 06:33
C4
top
/
PAT
PTA 数据结构与算法
题目集
(中文)6-1
6-1单链表逆转(20分)本题要求实现一个函数,将给定的单链表逆转。函数接口定义:ListReverse(ListL);其中List结构定义如下:typedefstructNode*PtrToNode;structNode{ElementTypeData;/*存储结点数据*/PtrToNodeNext;/*指向下一个结点的指针*/};typedefPtrToNodeList;/*定义单链表类型*/
Lukerman0
·
2020-08-09 06:30
PTA
数据结构
PAT甲级
1009. Product of Polynomials (25)
1009.ProductofPolynomials(25)时间限制400ms内存限制65536kB代码长度限制16000B判题程序Standard作者CHEN,YueThistime,youaresupposedtofindA*BwhereAandBaretwopolynomials.InputSpecification:Eachinputfilecontainsonetestcase.Eachc
Sitlos
·
2020-08-09 05:42
PAT甲级
pat甲级
1010 Radix (二分查找)
做题+看代码2h...debug半小时#include#include#include#include#includeusingnamespacestd;longlongconvert(stringn,longlongradix){longlong_n=0;inttemp=0,index=0;for(autoc=n.rbegin();c!=n.rend();c++){temp=isdigit(*c
Alternative_19
·
2020-08-09 05:11
pat甲级
PAT甲级
1011 World Cup Betting (20 分)
直接选大小#include#defineFIfirst#defineSEsecondusingnamespacestd;typedeflonglongll;constllmaxn=1e8+7;doublea1,a2,a3;doubleb1,b2,b3;doublec1,c2,c3;doubleans;voidsolve(doublea,doubleb,doublec){if(a>=b&&a>=c)
冰冰的小宝贝
·
2020-08-09 05:27
PAT甲级
PAT甲级
A1009 Product of Polynomials
PAT甲级
A1009ProductofPolynomials题目:Thistime,youaresupposedtofindA×BwhereAandBaretwopolynomials.InputSpecification
遇见更好的自己.jpg
·
2020-08-09 05:44
PAT甲级题解
【python】
PAT甲级
1010 Radix (24/25分)
题目Givenapairofpositiveintegers,forexample,6and110,canthisequation6=110betrue?Theanswerisyes,if6isadecimalnumberand110isabinarynumber.NowforanypairofpositiveintegersN1andN2,yourtaskistofindtheradixofon
汪汪碎冰冰
·
2020-08-09 05:43
PAT
【python】
PAT甲级
1011 World Cup Betting (20/20分)
题目Withthe2010FIFAWorldCuprunning,footballfanstheworldoverwerebecomingincreasinglyexcitedasthebestplayersfromthebestteamsdoingbattlesfortheWorldCuptrophyinSouthAfrica.Similarly,footballbettingfanswerep
汪汪碎冰冰
·
2020-08-09 05:43
PAT
PAT甲级
1011 World Cup Betting (20分)
1011WorldCupBetting(20分)题目链接:PATA1011思路分析:嗯…这道题就很迷,我不知道它那个公式是怎么来的,开始还以为是按照题意,不同的数据对应不同的公式,后来才发现所有数据都是那个公式,但是我不太理解(原谅笨笨的我,大家有明白的别忘了告诉我啊~),但是不影响做题。就是找每行中赔率最大的输出它所对应的的字母,然后用那个公式计算收益就可以了。AC代码:#includeusin
sosalt8
·
2020-08-09 05:38
PAT甲级题解
PAT甲级
1009 Product of Polynomials第一个测试点不通过
注意事项第一个测试点一直不过,后来把cnt计数放在外面就通过了。。。我这边的建议就是不要在计算乘积的时候计数,另外在循环一次计数原始代码#include#include#includeusingnamespacestd;structpolynomial{intexponent;doublecoefficient;};intmain(){intcnt=0,numa,numb;doubleresult
哦啦哦啦!
·
2020-08-09 05:02
PAT甲级
PAT甲级
1010radix
第一次题解(20分)#include#include#includeusingnamespacestd;typedeflonglongLL;stringN1,N2;intradix,tag;LLtemp[256];LLinf=(1LLt)return-1;}returnans;}LLfind_left(stringn){intlen=n.size();intans=-1;for(inti=0;ia
菜鸟的飞行日记
·
2020-08-09 05:00
pat甲级
PAT甲级
1011 World Cup Betting
PAT甲级
1011WorldCupBettingWiththe2010FIFAWorldCuprunning,footballfanstheworldoverwerebecomingincreasinglyexcitedasthebestplayersfromthebestteamsdoingbattlesfortheWorldCuptrophyinSouthAfrica.Similarly
旺 崽
·
2020-08-09 05:33
PAT甲级
排序
vector
PAT甲级
1009 Product of Polynomials
PAT甲级
1009ProductofPolynomialsThistime,youaresupposedtofindA×BwhereAandBaretwopolynomials.InputSpecification
旺 崽
·
2020-08-09 05:33
PAT甲级
模拟
根据二叉树的前序和中序或者后序和中序来确定二叉树结构(附例题)
这里给出两个例题:1.前序和中序确定:数据结构与算法
题目集
(中文)7-23还原二叉树(25分)给定一棵二叉树的先序遍历序列和中序遍历序列,要求计
这样啊我也喜欢
·
2020-08-09 05:22
基本算法与数据结构
PAT甲级
1011 World Cup Betting (20 分) 题解
\quad这个题难在题意理解上面,说白了就是给你九个数,三个一组,找出一组中最大的数字并记录下这个数所属类别(W,T,L)。一行是一组。最后把每个组最大的数乘起来,乘0.65,再减去1,最后将所得结果乘2输出。即(max1∗max2∗max3∗0.65−1)∗2(max_1*max_2*max_3*0.65-1)*2(max1∗max2∗max3∗0.65−1)∗2。#include#includ
程勇uestc
·
2020-08-09 05:20
PAT甲级
PAT甲级
1009 Product of Polynomials (25 分) 题解
\quad模拟多项式乘法,很简单,程序如下:#includeusingnamespacestd;intmain(){floatcoef[2001]={0},a[1001]={0},b[1001]={0};intnum1,num2;intexp;floattemp;scanf("%d",&num1);for(inti=0;i=0;--i){if(coef[i]!=0.0)printf("%d%.1f
程勇uestc
·
2020-08-09 05:20
PAT甲级
PAT甲级
1010 测试点
1010Radix(25分)测试点0:n1,n1n_1,n_1n1,n1相同;测试点7:二分法上界赢设置为已知数据+1,而不是已知数据测试点3,45,9,11:数据会超出intintint型范围,改成longlonglong\longlonglong即可测试点8,10,12,13,15,16:longlonglong\longlonglong同样会溢出,需要加上溢出判断,舍去即可#includeu
qq_33231894
·
2020-08-09 05:39
PAT甲级刷题历程
PAT (Advanced Level) Practice 1010 Radix
PAT甲级
最低通过率,果然名不虚传
RadixPATAdvancedLevel上面通过率最低的一题了。果然有很多坑分析:看到题目中0~z,很容易想象是36进制,然而实际上进制上不封顶,我们只有搜索,而一般的搜索会超时改为二分搜索这道题用int肯定不行的某些情况用longlongint还是会溢出,变成负数,这里要追加判断思路:题目给定了一个确定的数,先把它转换成10进制二分搜索,确认左边界右边界,左边界为另一个人串的最大数字+1(小于
hhmy77
·
2020-08-09 04:32
PAT
(Advanced
Level)
Practice
PAT题解
PAT甲级
1010 Radix (25 分)
题目:戳这里题意:输入四个数N1N2tagradix,其中tag为1表示N1的基数为radix,tag为2表示N2的基数为radix。求另一个数的基数,使得N1==N2。解题思路:这题用暴力试过了,超时,所以改成二分基数。不得不说一个正确的二分对我来说还是比较难写的,这题扣二分边界和一些坑,花了两个小时才满分。代码中注释的有我个人认为的坑点和我自己测试用的样例。#include#include#i
euzmin
·
2020-08-09 04:18
PAT甲级
PAT甲级
1012 The Best Rank
重复代码很多的一道模拟题,感觉写得不够好。坑点就是,可能会忘记分数相等时,排名是并列的,取高。至于课程的优先级问题,把高优先级的课程放在低优先级之后排序即可,如果排名相等,高优先级会覆盖掉低优先级。然后,最后针对m个id,输出最高排名。如果用线性扫描,复杂度O(nm),也不会超时。可以考虑对id排序,然后二分,我就懒得写了。#includeusingnamespacestd;constintmax
坤斤拷
·
2020-08-09 04:41
PAT甲级题解
PAT甲级
1010 Radix
思路很简单,把两个数分别转为10进制,然后进行比较。主要有几个坑:radix可能会很大(在题目中没有说明),要用longlong(经测试,能装下tag指定的数)要用二分搜索答案,否则会超时二分的初始上下界为tag指定的数值+1+1(一个+1是因为左闭右开,另一个是因为可能会有a10210这样的样例)和另一个数的最大位数+1(显然)若二分时mid过大,可能会导致结果为负数,要将这个可能加入判断中#i
坤斤拷
·
2020-08-09 04:41
PAT甲级题解
PAT甲级
1011 World Cup Betting
模拟题。#includeusingnamespacestd;constdoubleEPS=1e-6;charc[3]={'W','T','L'};charbuy[3];doubleans=0.65;voidread(){for(inti=0;iEPS){maxo=odd;buy[i]=c[j];}}ans*=maxo;}}voidsolve(){for(inti=0;i<3;++i){printf
坤斤拷
·
2020-08-09 04:41
PAT甲级题解
PAT甲级
1009 Product of Polynomials
O(n2)暴力模拟。两个多项式相乘,也就1e6,可以水过。当然,也可以选择写个链表,麻烦了些。#includeusingnamespacestd;constintmaxn=1e3+1;constintmaxm=2e3+2;constdoubleEPS=1e-6;intk;doublet[maxn];doubleans[maxm];intmain(){intn;doublea;scanf("%d",
坤斤拷
·
2020-08-09 04:40
PAT甲级题解
PAT甲级
1013 Battle Over Cities
题意,给定n个点,由m条无向边连接。现在,指定一个点删除,同时删除该点的邻边。问,余下的点最少要补多少条边才能够连通。既然是连通性问题,就上并查集吧。因为有k个case,先把边存下来。对于每个case,遍历边集,将未被删除的边的两端加入并查集。遍历完成后,检查该并查集有多少个根(也就有多少个连通块)。由于用一条边就可将两个点连接起来,所以需要的边的数量是根数-1。我用的cin,第一发第五个点t了,
坤斤拷
·
2020-08-09 04:05
PAT甲级题解
PAT甲级
1145Hashing - Average Search Time
题目链接https://pintia.cn/problem-sets/994805342720868352/problems/994805343236767744题解基础知识:哈希为做这道题,我简单复习了一下哈希(点击查看)。题目要求往一个哈希表里插入n个正整数,然后从哈希表里查找m个正整数,请输出平均查找次数(即比较次数)哈希函数定义为\(H(key)=key\%TSize\),其中\(TSiz
臭咸鱼
·
2020-08-07 23:00
PAT甲级
真题 1072 Gas Station (30分) C++实现(Dijkstra算法,测试点4四舍五入的坑)
题目Agasstationhastobebuiltatsuchalocationthattheminimumdistancebetweenthestationandanyoftheresidentialhousingisasfarawayaspossible.Howeveritmustguaranteethatallthehousesareinitsservicerange.Nowgiventhe
zhang35
·
2020-08-07 22:29
PAT
PAT甲级
——1095 Cars on Campus (排序、映射、字符串操作、题意理解)
1095CarsonCampus(30分)ZhejiangUniversityhas8campusesandalotofgates.Fromeachgatewecancollectthein/outtimesandtheplatenumbersofthecarscrossingthegate.Nowwithalltheinformationavailable,youaresupposedtotel
Little Panda
·
2020-08-07 21:55
PAT
(Advanced
Level)
Practice
PAT甲级
1072
#include#include#includeusingnamespacestd;constintinf=999999999;intn,m,k,ds,station;inte[1020][1020],dis[1020];boolvisit[1020];intmain(){fill(e[0],e[0]+1020*1020,inf);//for(inti=0;i>s>>t>>tempdis;inta
coder鹏鹏
·
2020-08-07 21:45
PAT
甲级
PAT甲级
刷题记录——1072 Gas Station (30分)
Agasstationhastobebuiltatsuchalocationthattheminimumdistancebetweenthestationandanyoftheresidentialhousingisasfarawayaspossible.Howeveritmustguaranteethatallthehousesareinitsservicerange.Nowgiventhema
囷囷
·
2020-08-07 21:20
PAT甲级
PAT甲级
A1139 First Contact (30 分)
Unlikeinnowadays,thewaythatboysandgirlsexpressingtheirfeelingsoflovewasquitesubtleintheearlyyears.WhenaboyAhadacrushonagirlB,hewouldusuallynotcontactherdirectlyinthefirstplace.Instead,hemightaskanothe
小·幸·运
·
2020-08-07 19:01
PAT甲级
图
PAT甲级
A1155 Heap Paths (30 分)
Incomputerscience,aheapisaspecializedtree-baseddatastructurethatsatisfiestheheapproperty:ifPisaparentnodeofC,thenthekey(thevalue)ofPiseithergreaterthanorequalto(inamaxheap)orlessthanorequalto(inaminhe
小·幸·运
·
2020-08-07 19:01
PAT甲级
递归
堆
DFS和BFS
PAT甲级
A1154 Vertex Coloring (25 分)
Apropervertexcoloringisalabelingofthegraph'sverticeswithcolorssuchthatnotwoverticessharingthesameedgehavethesamecolor.Acoloringusingatmostkcolorsiscalleda(proper)k-coloring.Nowyouaresupposedtotellifag
小·幸·运
·
2020-08-07 19:01
PAT甲级
图
哈希
PAT甲级
1049(数1)
1049CountingOnes(30point(s)) Thetaskissimple:givenanypositiveintegerN,youaresupposedtocountthetotalnumberof1’sinthedecimalformoftheintegersfrom1toN.Forexample,givenNbeing12,therearefive1’sin1,10,11,a
_云胡
·
2020-08-07 17:10
PAT甲级
PAT甲级
1120(友好数)
1120FriendNumbers(20point(s)) Twointegersarecalled“friendnumbers”iftheysharethesamesumoftheirdigits,andthesumistheir“friendID”.Forexample,123and51arefriendnumberssince1+2+3=5+1=6,and6istheirfriendID.
_云胡
·
2020-08-07 17:39
PAT甲级
PAT甲级
1104(子列之和)
1104SumofNumberSegments(20point(s)) Givenasequenceofpositivenumbers,asegmentisdefinedtobeaconsecutivesubsequence.Forexample,giventhesequence{0.1,0.2,0.3,0.4},wehave10segments:(0.1)(0.1,0.2)(0.1,0.2,0
_云胡
·
2020-08-07 17:39
PAT甲级
PAT甲级
OJ
浙大
PAT甲级
1069(数字黑洞)
1069TheBlackHoleofNumbers(20point(s)) Forany4-digitintegerexcepttheoneswithallthedigitsbeingthesame,ifwesortthedigitsinnon-increasingorderfirst,andtheninnon-decreasingorder,anewnumbercanbeobtainedbyt
_云胡
·
2020-08-07 17:39
PAT甲级
PAT甲级
1010(进制)
1010Radix(25point(s)) Givenapairofpositiveintegers,forexample,6and110,canthisequation6=110betrue?Theanswerisyes,if6isadecimalnumberand110isabinarynumber.NowforanypairofpositiveintegersN1andN2,yourtas
_云胡
·
2020-08-07 17:38
PAT甲级
PAT甲级
1101(快速排序)
1101QuickSort(25point(s)) Thereisaclassicalprocessnamedpartitioninthefamousquicksortalgorithm.Inthisprocesswetypicallychooseoneelementasthepivot.Thentheelementslessthanthepivotaremovedtoitsleftandtho
_云胡
·
2020-08-07 17:38
PAT甲级
PAT甲级
1004
1004CountingLeaves(30point(s))题目原文 Afamilyhierarchyisusuallypresentedbyapedigreetree.Yourjobistocountthosefamilymemberswhohavenochild.InputSpecification: Eachinputfilecontainsonetestcase.Eachcasesta
_云胡
·
2020-08-07 17:38
PAT甲级
PAT
甲级
OJ
【PAT A1060】Are They Equal 编译运行时错误的问题
PATA1060最近刚开始刷
PAT甲级
的题目,对C++的STL使用不够熟悉,就看《算法笔记》上的相关内容开始学习,正巧里面穿插了一道PAT的题目,主要与string的使用有关,我就试着做了一下。
姜之
·
2020-08-07 17:38
PAT
【刷题】A1095 Cars on Campus-
PAT甲级
1095CarsonCampus(30分)ZhejiangUniversityhas8campusesandalotofgates.Fromeachgatewecancollectthein/outtimesandtheplatenumbersofthecarscrossingthegate.Nowwithalltheinformationavailable,youaresupposedtotel
十三w~w
·
2020-08-07 17:59
PAT
PAT甲级
1095 Cars on Campus (30分) 繁琐
1095CarsonCampus(30分)ZhejiangUniversityhas8campusesandalotofgates.Fromeachgatewecancollectthein/outtimesandtheplatenumbersofthecarscrossingthegate.Nowwithalltheinformationavailable,youaresupposedtotel
qq_32691667
·
2020-08-07 16:05
算法
PAT甲级
1095 Cars on Campus (30 分)排序
参考链接:https://www.liuchuo.net/archives/29511095CarsonCampus(30分)ZhejiangUniversityhas8campusesandalotofgates.Fromeachgatewecancollectthein/outtimesandtheplatenumbersofthecarscrossingthegate.Nowwithallt
love music.
·
2020-08-07 16:05
PAT
PAT
PAT甲级
1095
1095.CarsonCampus(30)时间限制220ms内存限制65536kB代码长度限制16000B判题程序Standard作者CHEN,YueZhejiangUniversityhas6campusesandalotofgates.Fromeachgatewecancollectthein/outtimesandtheplatenumbersofthecarscrossingthegate
strivinging
·
2020-08-07 16:11
PAT
Is It A Red-Black Tree (30)-
PAT甲级
真题
Thereisakindofbalancedbinarysearchtreenamedred-blacktreeinthedatastructure.Ithasthefollowing5properties:(1)Everynodeiseitherredorblack.(2)Therootisblack.(3)Everyleaf(NULL)isblack.(4)Ifanodeisred,thenb
柳婼
·
2020-08-07 15:34
PAT
Cars on Campus (30)-
PAT甲级
真题(map,排序)
ZhejiangUniversityhas6campusesandalotofgates.Fromeachgatewecancollectthein/outtimesandtheplatenumbersofthecarscrossingthegate.Nowwithalltheinformationavailable,youaresupposedtotell,atanyspecifictimepo
柳婼
·
2020-08-07 15:34
PAT
PAT基础编程
题目集
----1
大家有什么疑问可以在评论区评论,一起交流进步啊o(∩_∩)o厘米转换英尺英寸importjava.util.Scanner;publicclassMain{publicstaticvoidmain(String[]args)throwsException{Scannerscan=newScanner(System.in);intread=scan.nextInt();doublerealFoot=
mirai2333
·
2020-08-07 13:28
基础原理-数据结构
[算法笔记-最全的PAT解答]
PAT甲级
1100 Mars Numbers
#include#include#include#includeusingnamespacestd;stringgeDigit[13]={"tret","jan","feb","mar","apr","may","jun","jly","aug","sep","oct","nov","dec"};stringtenDigit[13]={"tret","tam","hel","maa","huh",
Wave Zhou
·
2020-08-07 13:13
PAT甲级题解合集
数据结构
c++
PAT
map
[算法笔记-最全的PAT解答]
PAT甲级
1063 Set Similarity
#include#includeusingnamespacestd;constintN=51;setst[N];//thesetsarenumberedfrom1toNvoidcompare(inta,intb){//比较集合a与集合b//sameNum用来记录相同元素的个数distinctNum用来记录不同元素的个数intdistinctNum=st[b].size(),sameNum=0;//
Wave Zhou
·
2020-08-07 13:13
PAT甲级题解合集
[算法笔记-最全的PAT解答]
PAT甲级
1085 Perfect Sequence
#include#includeusingnamespacestd;constintmaxn=100010;intn,p,a[maxn];//(longlong)a[i]*p传给参数x//在[i+1,n-1]范围内查找第一个大于x的数的位置intbinarySearch(inti,longlongx){if(a[n-1]x说明你第一个大于x的数在mid之前(当然含mid)rightPoint=mi
Wave Zhou
·
2020-08-07 13:12
PAT甲级题解合集
上一页
15
16
17
18
19
20
21
22
下一页
按字母分类:
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
其他