随笔分类 -  PAT(A level)

浙大PAT 甲级题目解答,持续更新。
摘要: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... 阅读全文
posted @ 2015-12-06 11:17 白夜行zz 阅读(171) 评论(0) 推荐(0)
摘要: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 strings are a... 阅读全文
posted @ 2015-12-06 11:16 白夜行zz 阅读(168) 评论(0) 推荐(0)
摘要:Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1^k1 * p2^k2 *…*pm^km.Input Specification:Each input file contains one test case whic... 阅读全文
posted @ 2015-12-06 11:14 白夜行zz 阅读(136) 评论(0) 推荐(0)
摘要: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*105 with simple chopping. Now given the number of significa... 阅读全文
posted @ 2015-12-06 11:14 白夜行zz 阅读(191) 评论(0) 推荐(0)
摘要:If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid explained it to Harry, "Seventeen silver Sickles to a Galleon and twenty-nine Knuts to a Si... 阅读全文
posted @ 2015-12-06 11:13 白夜行zz 阅读(168) 评论(0) 推荐(0)
摘要:set的使用和它的迭代器的使用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 p... 阅读全文
posted @ 2015-12-06 11:12 白夜行zz 阅读(124) 评论(0) 推荐(0)
摘要:使用队列来模拟还在的人时间限制30 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueMice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a... 阅读全文
posted @ 2015-12-06 11:11 白夜行zz 阅读(191) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2015-12-06 11:10 白夜行zz 阅读(128) 评论(0) 推荐(0)
摘要:挺简单的,多占内存,少用循环Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area i... 阅读全文
posted @ 2015-12-06 11:07 白夜行zz 阅读(189) 评论(0) 推荐(0)
摘要:dfs函数携带vector形参记录搜索路径时间限制10 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven 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 ... 阅读全文
posted @ 2015-12-06 11:06 白夜行zz 阅读(168) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2015-12-06 11:05 白夜行zz 阅读(157) 评论(0) 推荐(0)
摘要:用一个vector 模拟栈每次检查输入,如果大于上次出栈的检查是否满足范围要求。满足的话将中间的数压栈如果小于上次出栈的检查是否为栈尾。满足的话最后一个数出栈Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are ... 阅读全文
posted @ 2015-12-06 11:02 白夜行zz 阅读(204) 评论(0) 推荐(0)
摘要:Given two strings S1 and S2, S = S1 - S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1 - S2 for any given strings. However, i... 阅读全文
posted @ 2015-12-06 11:01 白夜行zz 阅读(230) 评论(0) 推荐(1)
摘要:Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. However,... 阅读全文
posted @ 2015-12-06 11:00 白夜行zz 阅读(133) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2015-12-06 11:00 白夜行zz 阅读(155) 评论(0) 推荐(0)
摘要:时间限制400 ms内存限制64000 kB代码长度限制16000 B判题程序Standard作者CHEN, YueZhejiang University has 40000 students and provides 2500 courses. Now given the registered course list of each student, you are supposed to ou... 阅读全文
posted @ 2015-12-06 10:59 白夜行zz 阅读(443) 评论(0) 推荐(0)
摘要:The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input Specification:Each input file contains ... 阅读全文
posted @ 2015-12-06 10:58 白夜行zz 阅读(140) 评论(0) 推荐(0)
摘要:LCS 最大公共子序列。 memset函数需要include 时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueEva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors ... 阅读全文
posted @ 2015-12-06 10:57 白夜行zz 阅读(255) 评论(0) 推荐(0)
摘要:Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making the payment, the chain can be cut at any position ... 阅读全文
posted @ 2015-12-06 10:55 白夜行zz 阅读(174) 评论(0) 推荐(0)
摘要:时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, Yue(二叉树建立方法)A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node cont... 阅读全文
posted @ 2015-12-06 10:52 白夜行zz 阅读(158) 评论(0) 推荐(0)