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甲级
C语言.1004. 成绩排名
#include#defineN11//定为10会有部分错误structinfo{charname[N];charnum[N];intscore;};intmain(){intMax(structinfoinfo[],intn);intMin(structinfoinfo[],intn);intn,i,min,max;printf("inputnumber:");scanf("%d",&n);ge
Yoiker
·
2020-08-21 18:40
PAT甲级
PAT甲级
C语言.1002. 写出这个数
#includeintmain(){voidpinyin(int);chara[1000],num_str[10]={0},*temp;inti,j,sum=0;printf("getnumber:");gets(a);for(i=0;a[i]!='\0';++i){sum+=a[i]-'0';}printf("sum=%d\n",sum);sprintf(num_str,"%d",sum);/*
Yoiker
·
2020-08-21 18:40
PAT甲级
1008,1009解题报告
1008Elevator(20分)Thehighestbuildinginourcityhasonlyoneelevator.ArequestlistismadeupwithNpositivenumbers.Thenumbersdenoteatwhichfloorstheelevatorwillstop,inspecifiedorder.Itcosts6secondstomovetheelevat
Tate_Brown
·
2020-08-21 18:20
PAT
C
C++
浙江大学
PAT甲级
A1074题解(C++)(1)
#include#include#includeusingnamespacestd;intmain(){intfirst,n,k;cin>>first>>n>>k;//inttemp;inttemp,data[100005],next[100005],list[100005],result[100005];intsum=0;for(inti=0;i>temp;cin>>data[temp]>>ne
国氏一雄
·
2020-08-21 07:16
浙大PAT甲级
C++题解
pat甲级
1074(反转链表)
分类分析即可。仔细分析不难得出结论。自己写的ac的代码:#include#includeusingnamespacestd;constintmaxn=1000010;structNode{intaddress,next,data;intflag;//是否有效}node[maxn];boolcmp(Nodea,Nodeb){returna.flagi*k;j--){printf("%05d%d%05
人间理想xxf
·
2020-08-21 06:49
pat题解
PAT甲级
(1091)
题意理解(个人看法)1、每层MN个像素点共有L层,所以对一个MN*L的三维物体进行扫描,采用BFS进行搜索。2、X、Y、Z数组中的1和-1代表前后左右上下方向,1表示前进一格想正方向搜索,-1表示后退一格向后方搜索。3、先向X的正向搜索如果为1,cnt++,同时判断是否越界。#includeusingnamespacestd;structnode{intx,y,z;};intm,n,l,t;int
coder鹏鹏
·
2020-08-21 06:58
PAT
甲级
PAT甲级
(1057):Stack
树状数组参考链接很详细:树状数组详解#include#include#definelowbit(i)((i)&(-i))constintmaxn=100010;usingnamespacestd;intc[maxn];stacks;voidupdate(intx,intv){for(inti=x;i=1;i-=lowbit(i))sum+=c[i];returnsum;}voidPeekMedia
coder鹏鹏
·
2020-08-21 06:27
PAT
甲级
PAT甲级
1135
红黑树的特点1、根节点是黑色。2、如果一个节点是红色那么他的两个子节点都是红色。3、任意从根节点到叶子结点的路径上,所有的路径经过的黑色节点数相同。4、红黑树是二叉搜索树。算法1、根节点是否为黑色。2、红色节点的两个子节点是不是都是黑色。3、所有路径经过的黑色节点数是不是相同的。#includeusingnamespacestd;vectorarr;structnode{intkey;struct
coder鹏鹏
·
2020-08-21 06:57
PAT
甲级
【
PAT甲级
】1074 Reversing Linked List (25分)
解题过程的小记录,如有错误欢迎指出。难度:三星(需要考虑无效结点,还是不太习惯链表的思想orz)小导航~题目分析注意点我的解题过程思路bug代码dalao的代码借鉴点题目分析给出一串数列,按指定的长度一小块一小块进行逆转,小于指定的长度多出来的部分保持原状,输出数列注意点题目中存在无效结点(不在链表之中),不考虑的话最后一个测试点无法通过我的解题过程思路在输入的过程中采用静态链表存储信息,数字下标
Qiaoco
·
2020-08-21 06:02
PAT甲级
pat甲级
1032. Sharing (25)
欢迎访问我的
pat甲级
题解目录哦https://blog.csdn.net/richenyunqi/article/details/84981078题目描述算法设计可参考我在
pat甲级
1074.ReversingLinkedList
日沉云起
·
2020-08-21 05:39
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甲级
上一页
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
其他