- 博客(128)
- 资源 (5)
- 收藏
- 关注
原创 PAT_ (树补充)一般二叉树的LCA(Median) BST的LCA(Easy)
1143Lowest Common Ancestor(30分)The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.A binary search tree (BST) is recursively defined as a binary tree which has the following prop...
2020-07-19 23:42:40
477
原创 PAT_(树补充) 完全二叉树 BST 一般二叉树的构建
目录1110Complete Binary Tree(25分)1115Counting Nodes in a BST(30分)1119Pre- and Post-order Traversals(30分)1127ZigZagging on a Tree(30分)1110Complete Binary Tree(25分)Given a tree, you are supposed to tell if it is a complete binary tree.I...
2020-07-19 22:18:43
546
原创 PAT_ (分块 or 树状数组) 1057 Stack (30分)
1057Stack(30分)Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO).The basic operations include Push (inserting an element onto the top position) and Pop (deleting the top element)....
2020-07-18 18:13:03
298
原创 PAT_ (dp) 1007 1045 1040 1068
1007Maximum Subsequence Sum(25分)Given a sequence ofKintegers {N1,N2, ...,NK}. A continuous subsequence is defined to be {Ni,Ni+1, ...,Nj} where1≤i≤j≤K. The Maximum Subsequence is the continuous subsequence which has t...
2020-07-17 23:43:19
257
原创 PAT_(其他技巧-辅助数组) 1093 Count PAT‘s (25分) 1101 Quick Sort (25分)
目录1093Count PAT's(25分)1101Quick Sort(25分)1093Count PAT's(25分)The stringAPPAPTcontains twoPAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, and the...
2020-07-16 19:28:20
247
原创 PAT_(双指针 two pointer)1085 1089 Insert or Merge (25分) 1029 Median (25分) 1048
10851089Insert or Merge(25分)According to Wikipedia:Insertion sortiterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data, fin...
2020-07-15 23:08:44
231
原创 PAT_(二分-重要)1085* 1010* 1044* 1048
目录1085Perfect Sequence(25分)1010Radix(25分)1044Shopping in Mars(25分)1085Perfect Sequence(25分)Given a sequence of positive integers and another positive integerp. The sequence is said to be aperfect sequence\ifM≤m×p whereMandmar...
2020-07-15 21:38:49
223
原创 PAT_(贪心)1070 1033 1037 1067 1038
目录1070Mooncake(25分)1033To Fill or Not to Fill(25分)1037Magic Coupon(25分)1067Sort with Swap(0, i)(25分)1070Mooncake(25分)Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and c...
2020-07-14 10:50:09
176
原创 PAT_(hash)1084 1092 1041 1050 1048
1084Broken Keyboard(20分)On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.Now given a string that you are supposed to type, and the string ...
2020-07-12 23:59:52
206
原创 PAT_(数学问题)汇总 -3 1096 1059 B1017 1023 1024
质因子分解10961059大整数运算B101710231024
2020-07-11 22:24:54
296
原创 PAT_(数学问题)汇总-2 1008 1081 1088 1007 1013 1015 1078
gcd与lcd1008数组元素循环右移问题(20分)一个数组A中存有N(>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(≥0)个位置,即将A中的数据由(A0A1⋯AN−1)变换为(AN−M⋯AN−1A0A1⋯AN−M−1)(最后M个数循环移至最前面的M个位置)。如果需要考虑程序移动数据的次数尽量少,要如何设计移动的方法?输入格式:每个输入包含一个测试用例,第1行输入N(1≤N≤100)和M(≥0);第2行输入...
2020-07-10 19:59:45
503
原创 PAT_(数学问题)汇总-B1003 1069 The Black Hole of Numbers (20分) 1104 1008 1049 Counting Ones (30分)
目录1069The Black Hole of Numbers(20分) 游戏黑洞1104Sum of Number Segments(20分)1008Elevator(20分)1049Counting Ones(30分)1069The Black Hole of Numbers(20分) 游戏黑洞For any 4-digit integer except the ones with all the digits being the same, if we...
2020-07-09 17:13:44
372
原创 PAT_(STL使用)map-1100 Mars Numbers (20分)-1054 The Dominant Color (20分)-1071-1022
目录1100Mars Numbers(20分)1054The Dominant Color(20分)1071Speech Patterns(25分)1022Digital Library(30分)1100Mars Numbers(20分)People on Mars count their numbers with base 13:Zero on Earth is called "tret" on Mars. The numbers 1 to 12 on E...
2020-07-08 21:42:40
281
原创 PAT_(STL使用)set_string 1063 Set Similarity (25分) 1060 Are They Equal (25分)
1063 1060
2020-07-06 20:19:25
191
原创 PAT_(STL使用)1039 Course List for Student (25分) 1047 Student List for Course (25分)
目录1039Course List for Student(25分)1047Student List for Course(25分)1039Course List for Student(25分)Zhejiang University has 40000 students and provides 2500 courses.Now given the student name lists of all the courses, you are supposed to o...
2020-07-01 16:46:03
128
原创 PAT_(最短路径)1030 Travel Plan (30分) 1072 Gas Station (30分) 1087 All Roads Lead to Rome (30分)
1030Travel Plan(30分)A traveler's map gives the distances between cities along the highways, together with the cost of each highway.Now you are supposed to write a program to help a traveler to decide the shortest path between his/her starting c...
2020-06-29 17:35:18
396
转载 PAT_(最短路径)1003 Emergency (25分) 1018 Public Bike Management (30分)
目录1003Emergency(25分)1018Public Bike Management(30分)1003Emergency(25分)As an emergency rescue team leader of a city, you are given a special map of your country.The map shows several scattered cities connected by some roads. Amount of resc...
2020-06-29 16:43:49
246
原创 PAT_(图的遍历) 1034 ※ Head of a Gang (30分) 1076 Forwards on Weibo (30分)
目录1034Head of a Gang(30分)1076Forwards on Weibo(30分)1034Head of a Gang(30分)One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call betweenAandB, we say thatAandBis related.The wei...
2020-06-28 19:42:43
188
原创 PAT_(图的遍历)1013 Battle Over Cities 1021 Deepest Root
目录1013Battle Over Cities(25分)1021Deepest Root(25分)1013Battle Over Cities(25分)It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed....
2020-06-28 18:59:52
161
原创 PAT_(堆)1098 Insertion or Heap Sort (25分)
1098Insertion or Heap Sort(25分)According to Wikipedia:Insertion sortiterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data, finds the locatio...
2020-06-26 16:34:53
166
原创 PAT_(BST二叉查找树)1043 Is It a Binary Search Tree (25分) 1064 1099
目录1043Is It a Binary Search Tree(25分)1064Complete Binary Search Tree(30分)1099Build A Binary Search Tree(30分)1043Is It a Binary Search Tree(25分)A Binary Search Tree (BST) is recursively defined as a binary tree which has the following prop...
2020-06-25 16:09:46
269
原创 PAT_(树的遍历)1004 Counting Leaves (30分) 1053 Path of Equal Weight (30分)
1004 1004 Counting Leaves (30分)A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.Input Specification:Each input file contains one test case. Each case starts with a line con...
2020-06-25 15:43:33
129
原创 PAT_(树的遍历)1094 The Largest Generation (25)1106 Lowest Price in Supply Chain (25分)
1094 1106
2020-06-24 17:48:36
91
原创 PAT_(树的遍历)1079 Total Sales of Supply Chain (25分) 1090 Highest Price in Supply Chain (25分)
目录1079Total Sales of Supply Chain(25分)1090Highest Price in Supply Chain(25分)1079Total Sales of Supply Chain(25分)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product fr...
2020-06-24 16:00:15
1662
原创 PAT_(二叉树的遍历)1020Tree Traversals 1086 Tree Traversals Again 1102
目录1020Tree Traversals(25分)1086Tree Traversals Again(25分)1102Invert a Binary Tree(25分)1020Tree Traversals(25分)Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, y...
2020-06-23 16:18:58
161
原创 PAT_(搜索)1103 Integer Factorization (30分) 1091 Acute Stroke (30分)
1103Integer Factorization(30分)TheK−Pfactorization of a positive integerNis to writeNas the sum of theP-th power ofKpositive integers. You are supposed to write a program to find theK−Pfactorization ofNfor any positive integersN,Kand...
2020-06-22 17:38:42
161
原创 PAT_(链表处理) 1052 Linked List Sorting (25)1097 Deduplication on a Linked List (25)
1052Linked List Sorting(25分) 链表排序A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integerkeyand aNextpointer to the next structure. Now given a linked lis...
2020-06-22 11:44:55
127
原创 Python_装饰器decorator详解
Python decorator类似于java 注解 或者是spring的aopdef foo(): print('Foo!')foo()a=fooprint(type(a))a()Foo!def foo(): print('Foo!')def bar(func): print('Before') func() print('End') bar(foo)BeforeFoo!Enddef foo():...
2020-06-21 10:31:17
185
原创 PAT_(链表处理) 1074 Reversing Linked List 1032 Sharing
1074Reversing Linked List(25分)Given a constantKand a singly linked listL, you are supposed to reverse the links of everyKelements onL. For example, givenLbeing 1→2→3→4→5→6, ifK=3, then you must output 3→2→1→6→5→4; ifK=4, you must output...
2020-06-08 23:30:09
117
原创 PAT_(队列应用) 1056 Mice and Rice
1056Mice and Rice(25分)Mice and Riceis the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each mouse is to eat as much rice as possible in order to becom...
2020-06-06 10:41:47
121
原创 PAT_(栈) 1051 Pop Sequence
1051Pop Sequence(25分)Given a stack which can keepMnumbers at most. PushNnumbers in the order of 1, 2, 3, ...,Nand pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of the stack. For example,...
2020-06-06 09:41:02
136
原创 [读书笔记]CHAPTER 12 Custom Models and Training with TensorFlow
OReilly.Hands-On Machine Learning with Scikit-Learn, Keras, andTensorFlowCHAPTER 12 Custom Models and Training with TensorFlow几个问题记录一下:1. How would you describe TensorFlow in a short sentence? What are its main features? Can you name other popular D.
2020-05-12 18:15:16
260
原创 PAT_(排序)1028 1055 1075 1083
1028List Sorting(25分)1055The World's Richest(25分)1075PAT Judge(25分)1083List Grades(25分)
2020-05-08 22:11:53
173
原创 PAT_(排序) 1080 Graduate Admission (30分) 1095 Cars on Campus (30分)
1080Graduate Admission(30分)1095Cars on Campus(30分)
2020-05-01 16:21:12
208
原创 PAT_(排序) 1016 Phone Bills (25分) 1025 PAT Ranking (25分)
10161025102810551075108310801095
2020-04-30 23:53:16
139
原创 PAT_(排序) 1062 Talent and Virtue 1012 The Best Rank
1062Talent and Virtue(25分) (B1015 德才论)注意:cmp的编写:以及把所有的学生分为5类,排序规则#include<cstdio>#include<iostream>#include<algorithm>#include<vector>#include<string>...
2020-04-30 22:17:55
129
原创 PAT_(进制转换) A1019 A1027 A1058
目录1019General Palindromic Number(20分)1027Colors in Mars(20分)1058A+B in Hogwarts(20分)1019General Palindromic Number(20分)Sample Input 1:27 2Sample Output 1:Yes1 1 0 1 1...
2020-04-30 17:21:23
158
原创 PAT_(图形输出) B 1027打印沙漏 A 1031 Hello World for U
1019A1027 B10271031Hello World for U(20分)#include<vector>#include <sstream>#include<cmath>#include<iomanip>#include<iostream>#include <ctype.h>...
2020-04-30 16:51:10
218
简单粗暴Tensorflow2.0.pdf
2020-04-09
2017数学建模国赛+深圳杯优秀论文
2018-10-30
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人