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
甲级
1081 Rational Sum 分数处理问题
分数问题,一些小细节的处理特别麻烦,我这里采用的是别人整理好的系统化的方法来进行处理,下面讲解一下思路:这里的分数同一采用假分数的形式来处理,并且规定分母都为正,即如果分母为负数,上下同时取反,数0的写法为分子为0,分母为1化简时,求出分子分母的最大公约数(PS:这里规定求解时都转化成正数,有兴趣的可以百度一下负数的gcd就明白了),然后同时除以最大公约数即可关于输出最后的结果,有下列三种情况:分
哦啦哦啦!
·
2020-09-15 15:32
PAT甲级
PAT
甲级
1022(Digital Library)
使用结构:map,vector>;pair:遇到的一个坑点:最后两个测试点,因id输出必须输出7位,用int存储并输出的需要前位补0#includeusingnamespacestd;#definefinfreopen("in.txt","r",stdin)#definefoutfreopen("out.txt","w",stdout)typedefpairpis;map>mp;intn;void
bunner
·
2020-09-15 08:17
PAT
PAT
甲级
真题 1052 Linked List Sorting (25分) C++实现(模拟链表)
题目Alinkedlistconsistsofaseriesofstructures,whicharenotnecessarilyadjacentinmemory.WeassumethateachstructurecontainsanintegerkeyandaNextpointertothenextstructure.Nowgivenalinkedlist,youaresupposedtosor
zhang35
·
2020-09-15 06:32
PAT
链表
算法
数据结构
PAT
甲级
真题 1028 List Sorting (25分) C++实现(简单排序)
题目Excelcansortrecordsaccordingtoanycolumn.Nowyouaresupposedtoimitatethisfunction.InputEachinputfilecontainsonetestcase.Foreachcase,thefirstlinecontainstwointegersN(#include#includeusingnamespacestd;st
zhang35
·
2020-09-15 06:31
PAT
数据结构
快速排序
算法
PAT
甲级
1017. Queueing at Bank (25)
SupposeabankhasKwindowsopenforservice.Thereisayellowlineinfrontofthewindowswhichdevidesthewaitingareaintotwoparts.Allthecustomershavetowaitinlinebehindtheyellowline,untilitishis/herturntobeservedandth
小雪乃
·
2020-09-15 06:59
PAT甲级
浙江大学PAT
甲级
A1004(C++)题解
#include#includeusingnamespacestd;constintmaxN=100010;vectorNode[maxN];intN,M;intnumber[maxN]={0};intmaxH=-1;voidDFS(intindex,intdepth){if(depth>maxH){maxH=depth;}if(Node[index].size()==0){number[dept
国氏一雄
·
2020-09-15 06:18
浙大PAT甲级
C++题解
浙江大学PAT
甲级
A1043(C++)题解
#include#includeusingnamespacestd;structnode{intdata;node*lchild;node*rchild;};voidinsert(node*&root,intdata){if(root==NULL){root=newnode;root->data=data;root->lchild=root->rchild=NULL;return;}if(data
国氏一雄
·
2020-09-15 06:18
浙大PAT甲级
C++题解
PAT
甲级
1028 List Sorting 模拟+排序
Solution:这道题的意思是,有n(n#include#include#includeusingnamespacestd;intn,c;//n个学生,c为第几个选择structstudent{charid[10];charname[8];intgrade;}stu[100005];boolcmp1(studenta,studentb){returnstrcmp(a.id,b.id)<0;}bo
化身孤岛的鲸o
·
2020-09-15 06:34
PAT
模拟
PAT
甲级
1130 Infix Expression 抽象语法树AST
代码如下://抽象语法树AST#include#include#includeusingnamespacestd;structtree{stringkey;intleft,right;};vectort;intn;stringres="";intflag[30]={0};intRoot;voidinorder(introot){if(root==-1){return;}if(root!=Root&
化身孤岛的鲸o
·
2020-09-15 06:33
PAT
树
PAT甲级
PAT
甲级
A1130 Infix Expression (25 分)
Givenasyntaxtree(binary),youaresupposedtooutputthecorrespondinginfixexpression,withparenthesesreflectingtheprecedencesoftheoperators.InputSpecification:Eachinputfilecontainsonetestcase.Foreachcase,the
小·幸·运
·
2020-09-15 05:22
PAT甲级
树
【PAT
甲级
题解】1052 Linked List Sorting (25分)
本题常规链表题,与乙级有区别的地方是,这次要求对值排序,而不是翻转或者区块翻转,对于值排序,我选择使用第一个结构体按照散列存入list数组中,为了处理脏数据还能实现排序,选择使用第二个结构体node1存入vector中,然后对vector中的数据排序,排序后循环输出,坑点一:存在全部都是脏数据的情况,需要输出0和-1,但是第一次做测试点3错误扣3分,最终拿到22分,一直没找到答案,先放在这里,今后
苯酸氨酰糖化物
·
2020-09-15 05:06
PAT甲级题解
算法
c++
PAT
甲级
1028(列表排序)
1028ListSorting(25point(s)) Excelcansortrecordsaccordingtoanycolumn.Nowyouaresupposedtoimitatethisfunction.InputSpecification: Eachinputfilecontainsonetestcase.Foreachcase,thefirstlinecontainstwoint
_云胡
·
2020-09-15 05:05
PAT甲级
OJ
PAT
甲级
PTA
甲级
考试真题练习28——1028 List Sorting
题目思路水题代码#include#include#include#include#include#include#include#include#include#include#include#includeusingnamespacestd;#definenmax105#defineinf999999intnum,order;typedefstructinfo{longID;stringname
醉等佳人归
·
2020-09-15 05:32
PAT甲级考试真题练习
switch
算法
PAT
甲级
A1052 Linked List Sorting (25 分)
题目:1052LinkedListSorting(25分)Alinkedlistconsistsofaseriesofstructures,whicharenotnecessarilyadjacentinmemory.WeassumethateachstructurecontainsanintegerkeyandaNextpointertothenextstructure.Nowgivenalin
番茄杀手Dexter
·
2020-09-15 05:52
浙大 PAT
甲级
1028 List Sorting
分析继1027题之后第二水的一道题。整道题啥也没考,单纯考察一个sort函数用法而已。sort函数是包含在algorithm.h头文件中的一个函数,可以对数组以及STL中的容器排序。用法也很简单,代码一看就知道了~#include#include#include#includeusingnamespacestd;structRecord{intid;charname[9];intgrade;};v
马铃薯小弟
·
2020-09-15 05:57
PAT
PAT -
甲级
- 1052. Linked List Sorting (25)(链表)
Alinkedlistconsistsofaseriesofstructures,whicharenotnecessarilyadjacentinmemory.WeassumethateachstructurecontainsanintegerkeyandaNextpointertothenextstructure.Nowgivenalinkedlist,youaresupposedtosortt
i逆天耗子丶
·
2020-09-15 05:37
链表
PAT
(Advanced
Level)
浙江大学
PAT甲级
链表
1052.
Linked
List
So
Linked
List
Sorting
PAT -
甲级
- 1130. Infix Expression (25) (中序遍历)
题目描述:Givenasyntaxtree(binary),youaresupposedtooutputthecorrespondinginfixexpression,withparenthesesreflectingtheprecedencesoftheoperators.InputSpecification:Eachinputfilecontainsonetestcase.Foreachcas
i逆天耗子丶
·
2020-09-15 05:36
PAT
(Advanced
Level)
算法设计
-
递归求解
PAT
甲级
1119
1119.Pre-andPost-orderTraversals(30)时间限制400ms内存限制65536kB代码长度限制16000B判题程序Special作者CHEN,YueSupposethatallthekeysinabinarytreearedistinctpositiveintegers.Auniquebinarytreecanbedeterminedbyagivenpairofpos
strivinging
·
2020-09-15 05:43
PAT
PAT_
甲级
_1028
1028ListSortingExcelcansortrecordsaccordingtoanycolumn.Nowyouaresupposedtoimitatethisfunction.InputSpecification:Eachinputfilecontainsonetestcase.Foreachcase,thefirstlinecontainstwointegersN(≤105)andC
小白界的一股清流
·
2020-09-15 05:56
PAT甲级
浙大PAT
甲级
1038
就是求由这几数构成的数最小,对于两个字符串a,b。如果a+b#include#include#include#include#include#include#include#defineinf10000000usingnamespacestd;strings[10005];boolcmp(stringx,stringy){returnx+y>n;for(inti=0;i>s[i];}sort(s,
luowei5513
·
2020-09-15 05:50
浙大pat
PAT
甲级
1043. Is It a Binary Search Tree (25)
ABinarySearchTree(BST)isrecursivelydefinedasabinarytreewhichhasthefollowingproperties:Theleftsubtreeofanodecontainsonlynodeswithkeyslessthanthenode’skey.Therightsubtreeofanodecontainsonlynodeswithkeys
liaotl10
·
2020-09-15 05:02
PAT甲级
pat
甲级
A1028 List Sorting (25分)
题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805468327690240题目分析:多混合排序问题。对不同键值进行排序。问题是写比较函数。注意:若将姓名定义成string类型超时。不知道大家有没有出现这样的情况。望指正。string类型无法用printf以及scanf输入或者输出。参考代码:#include#
dutmathjc
·
2020-09-15 04:26
PAT甲级
字符串
leetcode
浙大pat
甲级
题目---1098. Insertion or Heap Sort (25)
AccordingtoWikipedia:Insertionsortiterates,consumingoneinputelementeachrepetition,andgrowingasortedoutputlist.Ateachiteration,insertionsortremovesoneelementfromtheinputdata,findsthelocationitbelongswi
dijiang0473
·
2020-09-15 04:20
数据结构与算法
PAT
甲级
1130 Infix Expression
1130InfixExpression(25point(s))Givenasyntaxtree(binary),youaresupposedtooutputthecorrespondinginfixexpression,withparenthesesreflectingtheprecedencesoftheoperators.InputSpecification:Eachinputfilecont
漫浸天空的雨色
·
2020-09-15 04:19
PAT甲级
PAT甲级/乙级机试经验
PAT
甲级
练习1028. List Sorting (25)
1028.ListSorting(25)时间限制200ms内存限制65536kB代码长度限制16000B判题程序Standard作者CHEN,YueExcelcansortrecordsaccordingtoanycolumn.Nowyouaresupposedtoimitatethisfunction.InputEachinputfilecontainsonetestcase.Foreachca
a1025461748
·
2020-09-15 04:42
PAT甲级练习
PAT-
甲级
-1004
1004.CountingLeaves(30)Afamilyhierarchyisusuallypresentedbyapedigreetree.Yourjobistocountthosefamilymemberswhohavenochild.InputEachinputfilecontainsonetestcase.Eachcasestartswithalinecontaining0#inclu
rv0p111
·
2020-09-15 04:10
PAT
PAT-
1028人口普查(C语言)
1028人口普查(20)(20分)某城镇进行人口普查,得到了全体居民的生日。现请你写个程序,找出镇上最年长和最年轻的人。这里确保每个输入的日期都是合法的,但不一定是合理的——假设已知镇上没有超过200岁的老人,而今天是2014年9月6日,所以超过200岁的生日和未出生的生日都是不合理的,应该被过滤掉。输入格式:输入在第一行给出正整数N,取值在(0,10^5];随后N行,每行给出1个人的姓名(由不超
ReTavemyliu
·
2020-09-15 04:20
C
浙大PAT
甲级
-1016
PhoneBills1.更改文件输入输出方式:freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);******//中间代码正常cin,coutfclose(stdin);fclose(stdout);2.vector删除某一项:删除v[i]:v.erase(v.begin()+i);【注】:删除某项后其后面的项会自动向前补
zbyue_
·
2020-09-15 04:14
浙大PAT甲级练习题
PAT(
甲级
)1028
1028.ListSorting(25)时间限制200ms内存限制65536kB代码长度限制16000B判题程序Standard作者CHEN,YueExcelcansortrecordsaccordingtoanycolumn.Nowyouaresupposedtoimitatethisfunction.InputEachinputfilecontainsonetestcase.Foreachca
Leonardo1897
·
2020-09-15 04:03
PAT(甲级)
PAT(
甲级
)1025
1025.PATRanking(25)时间限制200ms内存限制65536kB代码长度限制16000B判题程序Standard作者CHEN,YueProgrammingAbilityTest(PAT)isorganizedbytheCollegeofComputerScienceandTechnologyofZhejiangUniversity.Eachtestissupposedtorunsim
Leonardo1897
·
2020-09-15 04:02
PAT(甲级)
甲级
PAT 1028 List Sorting(sort排序)
1028ListSorting(25分)Excelcansortrecordsaccordingtoanycolumn.Nowyouaresupposedtoimitatethisfunction.InputSpecification:Eachinputfilecontainsonetestcase.Foreachcase,thefirstlinecontainstwointegersN(≤105
Joyceyang_999
·
2020-09-15 04:29
PAT甲级
PAT
甲级
1130. Infix Expression (25)
1130.InfixExpression(25)时间限制400ms内存限制65536kB代码长度限制16000B判题程序Standard作者CHEN,YueGivenasyntaxtree(binary),youaresupposedtooutputthecorrespondinginfixexpression,withparenthesesreflectingtheprecedencesofth
Jelly_acm
·
2020-09-15 04:28
----二叉树
PAT
PAT
甲级
1028. List Sorting (25)
Excelcansortrecordsaccordingtoanycolumn.Nowyouaresupposedtoimitatethisfunction.InputEachinputfilecontainsonetestcase.Foreachcase,thefirstlinecontainstwointegersN(#include#include#include#include#inclu
小雪乃
·
2020-09-15 04:28
PAT甲级
pat
甲级
1028. List Sorting (25)
欢迎访问我的pat
甲级
题解目录哦https://blog.csdn.net/richenyunqi/article/details/84981078题目描述C++代码#includeusingnamespacestd
日沉云起
·
2020-09-15 04:15
pat甲级
PAT_
甲级
_1130 中缀表达式 (25point(s))【中序遍历】
目录1,题目描述题目大意2,思路3,AC代码4,解题过程1,题目描述SampleInput1:8*87a-1-1*41+25b-1-1d-1-1--16c-1-1SampleOutput1:(a+b)*(c*(-d))SampleInput2:82.35-1-1*61--14%78+23a-1-1str-1-1871-1-1SampleOutput2:(a*2.35)+(-(str%871))题目
&再见萤火虫&
·
2020-09-15 04:09
PAT甲级
PAT
甲级
C++
1130
中序遍历
浙江大学PAT_
甲级
_1028. List Sorting (25)
题目链接:点击打开链接Excelcansortrecordsaccordingtoanycolumn.Nowyouaresupposedtoimitatethisfunction.InputEachinputfilecontainsonetestcase.Foreachcase,thefirstlinecontainstwointegersN(#include#include#includeusi
pythontojava
·
2020-09-15 04:57
PAT甲级
PAT -
甲级
- 1028. List Sorting (25)(排序)
Excelcansortrecordsaccordingtoanycolumn.Nowyouaresupposedtoimitatethisfunction.InputEachinputfilecontainsonetestcase.Foreachcase,thefirstlinecontainstwointegersN(#include#include#include#includeusingn
i逆天耗子丶
·
2020-09-15 04:49
PAT
(Advanced
Level)
算法设计
-
排序
PAT甲级
浙江大学
排序
List Sorting (25)-PAT
甲级
真题
Excelcansortrecordsaccordingtoanycolumn.Nowyouaresupposedtoimitatethisfunction.InputEachinputfilecontainsonetestcase.Foreachcase,thefirstlinecontainstwointegersN(#include#includeusingnamespacestd;cons
柳婼
·
2020-09-15 04:02
PAT
Linked List Sorting (25)-PAT
甲级
真题
Alinkedlistconsistsofaseriesofstructures,whicharenotnecessarilyadjacentinmemory.WeassumethateachstructurecontainsanintegerkeyandaNextpointertothenextstructure.Nowgivenalinkedlist,youaresupposedtosortt
柳婼
·
2020-09-15 04:02
PAT
PAT
甲级
1028. List Sorting (25)
Excelcansortrecordsaccordingtoanycolumn.Nowyouaresupposedtoimitatethisfunction.InputEachinputfilecontainsonetestcase.Foreachcase,thefirstlinecontainstwointegersN(#include#include#includeusingnamespace
liaotl10
·
2020-09-15 04:01
PAT甲级
浙大pat
甲级
题目---1028. List Sorting (25)
Excelcansortrecordsaccordingtoanycolumn.Nowyouaresupposedtoimitatethisfunction.InputEachinputfilecontainsonetestcase.Foreachcase,thefirstlinecontainstwointegersN(#include#include#includeusingnamespace
dijiang0473
·
2020-09-15 04:18
1028. List Sorting (25)
题目解析:PAT
甲级
再也没有比它更简单排序题了,解析略。
佩奇哥哥
·
2020-09-15 04:33
排序
PAT甲级真题题解
List Sorting (25) PAT
甲级
传送门#include#include#include#defineMAX_N100100usingnamespacestd;structStudent{intid;charname[15];intgrade;}stu[MAX_N];boolcmp1(structStudenta,structStudentb){returna.id
老虞面馆
·
2020-09-15 04:32
PAT
甲级
PAT
甲级
1028. List Sorting (25)
题目链接:https://www.patest.cn/contests/pat-a-practise/1028题目大意:根据输入要求将所给学生按照id、name、grade排序,按姓名和分数排序时若出现相同的情况,则将相同的按照id升序排列。解题思路:使用sort()函数,自定义比较方式cmp1代码如下:#include#include#include#includeusingnamespaces
NJU_Flipped
·
2020-09-15 04:01
PAT甲级
PAT
甲级
1028. List Sorting (25) 【结构体排序】
题目链接https://www.patest.cn/contests/pat-a-practise/1028思路就按照它的三种方式设计comp函数然后快排就好了但是如果用c++中的string保存名字的话就会超时所以用c里面的char*s就可以过AC代码#include#include#include#include#include#include#include#include#include#
Dup4
·
2020-09-15 03:54
PAT甲级
PAT-2019年秋季考试-
甲级
7-3 后缀表达式(Postfix Expressions) (25 分)
7-3PostfixExpression(25分)Givenasyntaxtree(binary),youaresupposedtooutputthecorrespondingpostfixexpression,withparenthesesreflectingtheprecedencesoftheoperators.InputSpecification:Eachinputfilecontains
就当一次路过丶
·
2020-09-15 02:54
pat
PAT-2019年秋季考试-
甲级
7-4 Dijkstra Sequence (30 分)
7-4DijkstraSequence(30分)Dijkstra’salgorithmisoneoftheveryfamousgreedyalgorithms.Itisusedforsolvingthesinglesourceshortestpathproblemwhichgivestheshortestpathsfromoneparticularsourcevertextoalltheother
就当一次路过丶
·
2020-09-15 02:22
pat
PAT-2019年秋季考试-
甲级
7-1 Forever (20 分)
7-1Forever(20分)“Forevernumber”isapositiveintegerAwithKdigits,satisfyingthefollowingconstrains:thesumofallthedigitsofAism;thesumofallthedigitsofA+1isn;andthegreatestcommondivisorofmandnisaprimenumberwh
就当一次路过丶
·
2020-09-15 02:52
pat
PAT-2019年秋季考试-
甲级
7-2 Merging Linked Lists (25 分)
7-2MergingLinkedLists(25分)GiventwosinglylinkedlistsL1=a1→a2→⋯→an−1→anandL2=b1→b2→⋯→bm−1→bm.Ifn≥2m,youaresupposedtoreverseandmergetheshorteroneintothelongeronetoobtainalistlikea1→a2→bm→a3→a4→bm−1⋯.Fore
就当一次路过丶
·
2020-09-15 02:52
pat
PAT
甲级
1007 Maximum Subsequence Sum (25 分)
题意:给定长度为n的序列,寻找最大字段和,按要求输出思路:滑动窗口,当前子段sum>=0时,右指针一直往右边滑动,如果当前序列sum变成的负数,那就把左指针往右滑动,直到序列sum变成非负数或者序列变空了;ps:如果最大子段和为负,如下操作:"IfalltheKnumbersarenegative,thenitsmaximumsumisdefinedtobe0,andyouaresupposedt
冰冰的小宝贝
·
2020-09-15 01:55
PAT甲级
上一页
14
15
16
17
18
19
20
21
下一页
按字母分类:
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
其他