摘要:PAT 1087 All Roads Lead to Rome题目:Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the rout...
阅读全文
随笔分类 - PAT
浙大PAT平台上的程序设计题目
摘要:PAT 1087 All Roads Lead to Rome题目:Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the rout...
阅读全文
摘要:PAT 1086 Tree Traversals Again题目:An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that wh...
阅读全文
摘要:PAT 1085 Perfect Sequence 题目:Given a sequence of positive integers and another positive integer p. The sequence is said to be a "perfect sequence" if ...
阅读全文
摘要:PAT 1084 Broken Keyboard题目:On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those...
阅读全文
摘要:1021. Deepest Root (25)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 root that results in a highest tree. Such a root is called the deepest root. Input Specification: Each input file contains one
阅读全文
摘要:1019. General Palindromic Number (20)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. All single digit numbers are palindromic numbers.Although palindromic numbers are most often considered in the
阅读全文
摘要:1018. Public Bike Management (30)There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and return it to any other stations in the city.The Public Bike Management Center (PBMC) keeps monitoring the
阅读全文
摘要:1017. Queueing at Bank (25)Suppose 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 parts. All the customers have to wait in line behind the yellow line, until it is his/her turn to be served and there is a window available
阅读全文
摘要:1016. Phone Bills (25) A long-distance telephone company charges its customers by the following rules: Making a long-distance call costs a certain amount per minute, depending on the time of day when the call is made. When a customer starts connecting a long-distance call, the tim...
阅读全文
摘要:1015. Reversible Primes (20) 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 reverse 37 is also a prime. Now given any two positive integers N (#include...
阅读全文
摘要:1014. Waiting in Line (30) Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are: The space inside the yellow line in front of each window is eno...
阅读全文
摘要: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 need to repair any other highways to keep the rest of ...
阅读全文
摘要:1012. The Best Rank (25) 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 Algrbra), and E - English. At the mean time, we encourage students by emphasiz...
阅读全文
摘要:1011. World Cup Betting (20) 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 battles for the World Cup trophy in South Africa. Similarly, football betting fans were putting their mon...
阅读全文
摘要:1010. Radix (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 integers N1 and N2, your task is to find the radix of one number wh...
阅读全文
摘要:1009. Product of Polynomials (25) This time, you are supposed to find A*B where A and B are two polynomials. Input Specification: Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomial: K N1 aN1 N2 aN2 ... NK aNK, ...
阅读全文
摘要:1008. Elevator (20) The 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 the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seconds to move d...
阅读全文
摘要:1007. Maximum Subsequence Sum (25) Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 23intmain()4{5intK;6intdata[10000];7inti;8intflag;9while(scanf("%d",&K)!=EOF){10flag=0;11for(i=0;i=0)14flag=1;15}16if(flag==0).
阅读全文
摘要:1006. Sign In and Sign Out (25) At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, you are supposed to find the ones who have unlocked a...
阅读全文
摘要:1005. Spell It Right (20) Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. Input Specification: Each input file contains one test case. Each case occupies one line which contains an N (2#include3...
阅读全文
|