随笔分类 -  PAT(A level)

浙大PAT 甲级题目解答,持续更新。
摘要: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... 阅读全文
posted @ 2015-12-06 10:24 白夜行zz 阅读(214) 评论(0) 推荐(0)
摘要:首先计算连通分量。dfs然后分两种情况,n数目很小的时候对每个节点dfs,n大的时候超时n数目大的时候计算只具有单边的节点数。n小的时候答案错误两者结合就好了,当然这是一种不可取的办法。。。。。A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the ... 阅读全文
posted @ 2015-12-06 10:22 白夜行zz 阅读(203) 评论(0) 推荐(0)
摘要:根据两种遍历方式建立二叉树层遍历二叉树时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueSuppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequen... 阅读全文
posted @ 2015-12-06 10:19 白夜行zz 阅读(130) 评论(0) 推荐(0)
摘要:比较复杂的dfs 注意算好到底需要send多少take back多少时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThere is a public bike service in Hangzhou City which provides great convenience to the tourists from all ov... 阅读全文
posted @ 2015-12-06 10:18 白夜行zz 阅读(140) 评论(0) 推荐(0)
摘要:时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromi... 阅读全文
posted @ 2015-12-06 10:18 白夜行zz 阅读(147) 评论(0) 推荐(0)
摘要:时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, Yue 去掉非法数据计算账单A long-distance telephone company charges its customers by the following rules:Making a long-distance call costs a certain amoun... 阅读全文
posted @ 2015-12-06 10:17 白夜行zz 阅读(301) 评论(0) 推荐(0)
摘要:排队模型时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueSuppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two part... 阅读全文
posted @ 2015-12-06 10:17 白夜行zz 阅读(155) 评论(0) 推荐(0)
摘要:1,不同基底的反数算法,2,输入 cin 使用A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its ... 阅读全文
posted @ 2015-12-06 10:15 白夜行zz 阅读(129) 评论(0) 推荐(0)
摘要:排队模型先把每个窗口的黄线排满如果还有人的话,前面完事儿一个插入一个。最后把每个队伍的人服务完。时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueSuppose a bank has N windows open for service. There is a yellow line in front of the windows ... 阅读全文
posted @ 2015-12-06 10:14 白夜行zz 阅读(180) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2015-12-06 10:12 白夜行zz 阅读(121) 评论(0) 推荐(0)
摘要:To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algebra), and E - Eng... 阅读全文
posted @ 2015-12-06 10:11 白夜行zz 阅读(205) 评论(0) 推荐(0)
摘要:时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueWith the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams ... 阅读全文
posted @ 2015-12-06 10:07 白夜行zz 阅读(148) 评论(0) 推荐(0)
摘要:简直是哭着做出来的,起码提交了22遍。创纪录了。。。首先不能像上次那样枚举进制数,那样输入987654321 10 1 10 的话十分钟都算不完,题中只有一个超时很照顾人了。。。考虑近似计算,利用y=a*x^n+b 算出n,进制数如果有,也不会超过n,因此考虑由n向下寻找。注意,进制数不能小于数中最大的数字。如果将两个数字作为字符串输入,注意排除字符串前面的0.时间限制400 ms内存限制6553... 阅读全文
posted @ 2015-12-06 10:06 白夜行zz 阅读(170) 评论(0) 推荐(0)
摘要:时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThe highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors ... 阅读全文
posted @ 2015-12-06 09:59 白夜行zz 阅读(153) 评论(0) 推荐(0)
摘要:Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 #include #include using namespace std;vector num;int main(void) { int n; ci... 阅读全文
posted @ 2015-12-06 09:57 白夜行zz 阅读(128) 评论(0) 推荐(0)
摘要:注意字符串的输入方法char a[100] = { 0 };scanf("%s", &a);时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven a non-negative integer N, your task is to compute the sum of all the digits of N, and outp... 阅读全文
posted @ 2015-12-06 09:55 白夜行zz 阅读(186) 评论(0) 推荐(0)
摘要:注意:1,结构体的应用。2,向量的应用,#include vectorp; 用于不定数目的时候的数组创建3,cin 和cout的使用,#include4,字符串的使用 用#include 可以使用string s;时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueAt the beginning of every day, t... 阅读全文
posted @ 2015-12-06 09:55 白夜行zz 阅读(161) 评论(0) 推荐(0)
摘要:使用map保存树,使用DFS进行树的搜索时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.In... 阅读全文
posted @ 2015-12-06 09:49 白夜行zz 阅读(182) 评论(0) 推荐(0)
摘要: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 rescue teams in each city and the l... 阅读全文
posted @ 2015-12-06 09:48 白夜行zz 阅读(181) 评论(0) 推荐(0)
摘要:注意输入输出的:1,输入小数的语句 scanf("%lf", &a)2,输出一位小数的语句 printf("%.1f", count);时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThis time, you are supposed to find A+B where A and B are two polynomials.... 阅读全文
posted @ 2015-12-06 09:47 白夜行zz 阅读(212) 评论(0) 推荐(0)