随笔分类 -  PAT

摘要:1 #include 2 int main() 3 { 4 int n,m,a,b,tem,pre,p; 5 int i,j; 6 int ans[100005]; 7 while(scanf("%d",&n)!=EOF) 8 { 9 ans[0]=0;... 阅读全文
posted @ 2015-01-31 23:34 小爷 阅读(123) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 int main() 4 { 5 long long a,b,c,sum; 6 int n,i; 7 while(scanf("%d",&n)!=EOF) 8 { 9 for(i=1;i0&&b>0... 阅读全文
posted @ 2015-01-31 23:32 小爷 阅读(184) 评论(0) 推荐(0)
摘要:时间限制400 ms内存限制32000 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThis time, you are supposed to find A+B where A and B are two polynomials.InputEach input fi... 阅读全文
posted @ 2015-01-31 07:34 小爷 阅读(156) 评论(0) 推荐(0)
摘要:时间限制400 ms内存限制32000 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA family hierarchy is usually presented by a pedigree tree. Your job is to count those famil... 阅读全文
posted @ 2015-01-31 07:33 小爷 阅读(173) 评论(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 c... 阅读全文
posted @ 2015-01-30 07:48 小爷 阅读(358) 评论(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 - Mat... 阅读全文
posted @ 2015-01-30 07:45 小爷 阅读(832) 评论(0) 推荐(0)
摘要:With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing ba... 阅读全文
posted @ 2015-01-30 07:43 小爷 阅读(197) 评论(0) 推荐(0)
摘要:Areversibleprimeinanynumbersystemisaprimewhose"reverse"inthatnumbersystemisalsoaprime.Forexampleinthedecimalsystem73isareversibleprimebecauseitsrevers... 阅读全文
posted @ 2015-01-30 07:40 小爷 阅读(265) 评论(0) 推荐(0)
摘要:1、前序+中序—>树这个天勤《高分笔记》树那章的真题仿造上就有核心代码如下:S->lchild=CreateBT(pre,in,l1+i,l1+i-l2,l2,i-1);S->rchild=CreateBT(per,in,l1+i-l2+1,r1,i+1,r2);例:前序:1352467中序:532... 阅读全文
posted @ 2015-01-28 13:43 小爷 阅读(754) 评论(0) 推荐(0)
摘要:http://www.patest.cn/contests/pat-a-practise/1043 1 #include 2 #include 3 using namespace std; 4 5 struct Node 6 { 7 Node* lchild; 8 ... 阅读全文
posted @ 2015-01-28 13:41 小爷 阅读(238) 评论(0) 推荐(0)
摘要:二叉排序树:http://www.patest.cn/contests/pat-a-practise/1064 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int ans[1002]; 7 8 int cnt = 0... 阅读全文
posted @ 2015-01-28 13:40 小爷 阅读(160) 评论(0) 推荐(0)
摘要:A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the 阅读全文
posted @ 2015-01-28 13:38 小爷 阅读(310) 评论(0) 推荐(0)
摘要:Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to ou... 阅读全文
posted @ 2015-01-28 13:37 小爷 阅读(235) 评论(0) 推荐(0)
摘要:A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number... 阅读全文
posted @ 2015-01-28 13:35 小爷 阅读(241) 评论(0) 推荐(0)
摘要:One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B, we say that A and B is re... 阅读全文
posted @ 2015-01-26 07:38 小爷 阅读(337) 评论(0) 推荐(0)
摘要: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 s... 阅读全文
posted @ 2015-01-26 07:36 小爷 阅读(285) 评论(0) 推荐(0)
摘要: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:hdellrlo... 阅读全文
posted @ 2015-01-26 07:35 小爷 阅读(377) 评论(0) 推荐(0)
摘要:PAT Ranking (排名)Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is sup... 阅读全文
posted @ 2015-01-22 07:30 小爷 阅读(437) 评论(0) 推荐(0)
摘要:A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number... 阅读全文
posted @ 2015-01-22 07:28 小爷 阅读(310) 评论(0) 推荐(0)
摘要: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 2469135... 阅读全文
posted @ 2015-01-22 07:26 小爷 阅读(475) 评论(0) 推荐(0)