PAT(甲级)
文章平均质量分 72
SunLight Jr
自由思想,独立精神。
展开
-
Python爬虫实习笔记 | Week6 Daliy工作流水
2018/11/191.所思所想上午主要就是做自己的事情,是的,如果没有一天天的积淀,而完全依靠项目中的不足而及时弥补,很难发现自己的痛点,并自觉的去完善。下午可以说很成功,虽然没有做具体任务,但却解决了“困境”中的一环:不需要手动寻找我们需要爬取的数据,主要是url,而是根据html文档自有的特性,及所爬去模块的特征去寻找,可以说相当棒了。2.工作:【1】184 长沙市环保局 没找到...原创 2018-11-24 12:04:45 · 911 阅读 · 0 评论 -
PAT(Advanced) 1062 Talent and Virtue(25 分)
About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people's talent and virtue. According to his theory, a man being outstanding in both talent and virt...原创 2018-08-31 15:57:09 · 86 阅读 · 0 评论 -
PAT(Advanced) 1060 Are They Equal(25 分)【浮点数模拟】
If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123×105with simple chopping. Now given the number of signifi...原创 2018-08-31 15:23:47 · 184 阅读 · 0 评论 -
PAT 1096 Consecutive Factors (20)
Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3*5*6*7, where 5, 6, and 7 are the three consecutive numbers. Now given ...原创 2018-08-17 14:50:25 · 183 阅读 · 0 评论 -
PAT(Advanced) 1095 Cars on Campus (30)
Zhejiang University has 6 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with all the information available, you a...原创 2018-08-17 14:10:44 · 99 阅读 · 0 评论 -
PAT(Advanced) 1065 A+B and C (64bit) (20)
Given three integers A, B and C in [-2^63^, 2^63^], you are supposed to tell whether A+B > C.Input Specification:The first line of the input gives the positive number of test cases, T (<=10)...原创 2018-08-16 22:23:23 · 222 阅读 · 3 评论 -
PAT(Advanced) 1061 Dating (20)
Sherlock Holmes received a note with some strange strings: "Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm". It took him only a minute to figure out that those strange strin...原创 2018-08-16 21:15:21 · 115 阅读 · 0 评论 -
PAT(Advanced) 1055 The World's Richest(25 分)
Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world's wealthiest people. Now you are supposed to simulate this job, but concentrate only on the peopl...原创 2018-08-16 15:27:08 · 120 阅读 · 0 评论 -
PAT(Advanced) 1052 Linked 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 integer key and a Next pointer to the next structure. Now give...原创 2018-08-16 10:25:28 · 106 阅读 · 0 评论 -
PAT 1010 Radix (25)(25 分)
Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is "yes", if 6 is a decimal number and 110 is a binary number.Now for any pair of positive in...原创 2018-08-08 23:04:17 · 279 阅读 · 0 评论 -
PAT 1047 Student List for Course(25 分)
1047 Student List for Course(25 分)Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output the student nam...原创 2018-08-15 23:38:45 · 140 阅读 · 0 评论 -
PAT 1038 Recover the Smallest Number (30)(30 分)
Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given {32, 321, 3214, 0229, 87}, we can recover many numbers such like 32-321-3214-0229-8...原创 2018-08-15 22:13:24 · 140 阅读 · 0 评论 -
PAT(Advanced) 1063 Set Similarity(25 分)【集合操作】
Given two sets of integers, the similarity of the sets is defined to be Nc/Nt×100%, where Nc is the number of distinct common numbers shared by the two sets, and Nt is the total number of ...原创 2018-08-31 17:14:02 · 100 阅读 · 0 评论 -
PAT(Advanced) 1067 Sort with Swap(0, i)(25 分)
Given any permutation of the numbers {0, 1, 2,..., N−1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is allowed to use? For example, to sort {4, 0, 2...原创 2018-08-31 22:44:32 · 134 阅读 · 0 评论 -
Disjkstra最短路径-算法题总结
【最短路径】之Dijkstra算法**总结的最后配有4道PAT练习题及参考答案最短路径单源最短路径:计算源点到其他各顶点的最短路径的长度 全局最短路径:图中任意两点的最短路径 Dijkstra、Bellman-Ford、SPFA求单源最短路径 Floyed可以求全局最短路径,但是效率比较低 SPFA算法是Bellm...转载 2018-08-29 16:06:20 · 1335 阅读 · 0 评论 -
PAT(Advanced) 1081 Rational Sum(20 分)
Given N rational numbers in the form numerator/denominator, you are supposed to calculate their sum.Input Specification:Each input file contains one test case. Each case starts with a positive int...原创 2018-09-03 15:26:15 · 153 阅读 · 0 评论 -
PAT 1097 Deduplication on a Linked List(25 分)
Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each value K, only the first node of which the value or a...原创 2018-09-02 17:17:07 · 132 阅读 · 0 评论 -
PAT(Advanced) 1074 Reversing Linked List(25 分)
Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, if K=3, then you must output 3→2→1→6→5→4; if K=4,...原创 2018-09-02 17:06:31 · 107 阅读 · 0 评论 -
PAT(Advanced) 1086 Tree Traversals Again(25 分)【模拟建树】
An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6) is traversed, the stac...原创 2018-09-02 15:50:26 · 106 阅读 · 0 评论 -
PAT 1064 Complete Binary Search Tree(30 分)
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node's key. The right su...原创 2018-09-02 11:28:18 · 92 阅读 · 0 评论 -
PAT 1013 Battle 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. We must know immediately if we nee...原创 2018-08-30 10:18:43 · 101 阅读 · 0 评论 -
PAT(Advanced) 1053 Path of Equal Weight(30 分)
Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to L is defined to be the sum of the weights of all the nodes along the path fro...原创 2018-09-01 22:38:32 · 134 阅读 · 0 评论 -
PAT(Advanced) 1084 Broken 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...原创 2018-09-04 16:41:59 · 146 阅读 · 0 评论 -
PAT 1082 Read Number in Chinese(25 分)
Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output Fu first if it is negative. For example, -123456789 is read as Fu yi Yi er Qian san Bai ...原创 2018-09-04 16:15:25 · 176 阅读 · 0 评论 -
PAT(Advanced) 1043 Is It a Binary Search Tree(25 分)
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node's key. The right su...原创 2018-09-01 17:30:48 · 109 阅读 · 0 评论 -
PAT(Advanced) 1003 Emergency、1030 Travel Plan、1072 Gas Station、1087 All Roads Lead to Rome【最短路径】
题目:略。解答:今天(2018/8/29)我将迪杰斯特拉算法复习了下,收获良多,然后将其用邻接矩阵和邻接链表都实现了下,今晚刷了PAT甲级中的1072 Gas Station(30 分)、1003 Emergency(25 分)和1030 Travel Plan(30 分),都是最短路径问题,其中1072题应该是比较烦的了,花的时间也比较久,但思路都相同,dijkstra算法的实现在我另一篇博...原创 2018-08-29 22:20:00 · 156 阅读 · 0 评论 -
PAT 1032 Sharing (25)(25 分)
To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For example,...原创 2018-08-15 21:35:56 · 120 阅读 · 0 评论 -
PAT 1029 Median(25 分)
Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 12, and the median of S2 = { 9, 10, 15, 16, 17 } is...原创 2018-08-15 18:26:53 · 117 阅读 · 0 评论 -
PAT 1022 Digital Library (30)(30 分)
A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number a...原创 2018-08-15 10:39:38 · 77 阅读 · 0 评论 -
PAT 1040 Longest Symmetric String (25)
1040 Longest Symmetric String (25)(25 分)Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given "Is PAT&TAP symmetric?", the longest symmetric...原创 2018-07-14 22:31:52 · 161 阅读 · 0 评论 -
PAT-1027 Colors in Mars (20)
1027 Colors in Mars (20)(20 分)People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits...原创 2018-07-14 21:43:06 · 160 阅读 · 0 评论 -
PAT 1023-Have Fun with Numbers (20)
1023 Have Fun with Numbers (20)(20 分)Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which hap...原创 2018-07-14 17:41:14 · 158 阅读 · 0 评论 -
PAT-1025 PAT Ranking (25)
Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists w...原创 2018-07-14 10:02:51 · 151 阅读 · 0 评论 -
PAT 1035 Password (20)
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L ...原创 2018-07-19 16:57:13 · 102 阅读 · 0 评论 -
PAT 1028 List Sorting (25)
Excel can sort records according to any column. Now you are supposed to imitate this function.InputEach input file contains one test case. For each case, the first line contains two integers N (&l...原创 2018-07-19 16:32:59 · 126 阅读 · 0 评论 -
PAT 2002-A+B for Polynomials
1002 A+B for Polynomials (25)(25 分)This time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and each line cont...原创 2018-07-12 22:29:07 · 121 阅读 · 0 评论 -
PAT-1012 The Best Rank
/*PAT-1012 The Best Rank*//*本题考察结构体、排序算法sort的运用,如果用STL库vector可简化计算。*//*可能遇到的问题是,排序的分数如果相同,那么他们的排名相同,后面的人排名向后移。比如: 第一名和第二名的成绩相同,那么他们的排名都是1,而第三名成绩是3.*/#include<iostream>#include<string>#in...原创 2018-07-12 19:33:29 · 185 阅读 · 0 评论 -
PAT 1049 Counting Ones (30)
The task is simple: given any positive integer N, you are supposed to count the total number of 1's in the decimal form of the integers from 1 to N. For example, given N being 12, there are five 1's i...原创 2018-07-23 11:06:26 · 104 阅读 · 0 评论 -
PAT 1031 Hello World for U (20)
Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. For example, "helloworld" can be printed as:h de ll rlowoThat is, the characters must b...原创 2018-07-16 17:18:31 · 109 阅读 · 0 评论 -
PAT 1036 Boys vs Girls (25)
This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specification:Each input file contains one t...原创 2018-07-16 17:15:42 · 98 阅读 · 0 评论