随笔分类 - PAT 甲级
摘要:Given a tree, you are supposed to tell if it is a complete binary tree. Input Specification: Each input file contains one test case. For each case, th
阅读全文
摘要:In July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown in the picture below) for recruitment. The content is supe
阅读全文
摘要:When shipping goods with containers, we have to be careful not to pack some incompatible goods into the same container, or we might get ourselves in s
阅读全文
摘要:Werewolf(狼人杀) is a game in which the players are partitioned into two parties: the werewolves and the human beings. Suppose that in a game, player #1
阅读全文
摘要:Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specification: Each input file contains
阅读全文
摘要:After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the rank
阅读全文
摘要:Look-and-say sequence is a sequence of integers as the following: D, D1, D111, D113, D11231, D112213111, ... where D is in [0, 9] except 1. The (n+1)s
阅读全文
摘要:Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that
阅读全文
摘要:For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/
阅读全文
摘要:Consider a positive integer N written in standard notation with k+1 digits ai as ak⋯a1a0 with 0 for all i and ak>0. Then N is palindrom
阅读全文
摘要:The "eight queens puzzle" is the problem of placing eight chess queens on an 8 chessboard so that no two queens threaten each other. Thus, a solution
阅读全文
摘要:John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for his followers on Weibo -- that is, he would select winners from
阅读全文
摘要:Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fold two segments into loops and chain them into one
阅读全文
摘要:"Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are supposed to find those who are alone in a big party, so they can
阅读全文
摘要:"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of th
阅读全文
摘要:Two integers are called "friend numbers" if they share the same sum of their digits, and the sum is their "friend ID". For example, 123 and 51 are fri
阅读全文
摘要:British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an "Eddington number", E -- tha
阅读全文
摘要:Formation is very important when taking a group photo. Given the rules of forming K rows with N people as the following: The number of people in each
阅读全文
摘要:On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding to those keys will appear rep
阅读全文
摘要:The basic task is simple: given N real numbers, you are supposed to calculate their average. But what makes it complicated is that some of the input n
阅读全文