1008 Elevator (20 point(s))

1008 Elevator (20 point(s))The highest building in our city has only one elevator. A request list is made up withNpositive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator u..
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1009 Product of Polynomials (25 point(s))

1009 Product of Polynomials (25 point(s))This time, you are supposed to findA×BwhereAandBare two polynomials.Example:#include<iostream>#include<cstdio>#include<cmath>#include<vector>#include<map>using namesp...
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1010 Radix (25 point(s))

1010 Radix (25 point(s))Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer isyes, if 6 is a decimal number and 110 is a binary number.Now for any pair of positive integersN​1​​andN​2​​, your tas...
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1011 World Cup Betting (20 point(s))

1011 World Cup Betting (20 point(s))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, footba...
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1012 The Best Rank (25 point(s))

1012 The Best Rank (25 point(s))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), andE- English. At the mean time...
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1013 Battle Over Cities (25 point(s))

1013 Battle Over Cities (25 point(s))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 o
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1014 Waiting in Line (30 point(s))

1014 Waiting in Line (30 point(s))Suppose a bank hasNwindows 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 l..
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1015 Reversible Primes (20 point(s))

1015 Reversible Primes (20 point(s))Areversible primein 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 an..
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1016 Phone Bills (25 point(s))

1016 Phone Bills (25 point(s))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 conne
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1017 Queueing at Bank (25 point(s))

1017 Queueing at Bank (25 point(s))Suppose a bank hasKwindows 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..
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1018 Public Bike Management (30 point(s))

1018 Public Bike Management (30 point(s))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 Pu
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1019 General Palindromic Number (20 point(s))

1019 General Palindromic Number (20 point(s))A number that will be the same when it is written forwards or backwards is known as aPalindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers.Althou.
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1020 Tree Traversals (25 point(s))

1020 Tree Traversals (25 point(s))Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the corresponding binary tr
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1021 Deepest Root (25 point(s))

思路:利用深度优先搜索 DFS,获得连通分量的个数,若个数大于 1 ,则输出错误消息;若连通分量分数为1,则利用广度优先搜索 BFS 获取根的对应深度,从中输出满足最大值的结点。1021 Deepest Root (25 point(s))A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you ar
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1022 Digital Library (30 point(s))

思路:每个查询条件建立索引,索引 id 号,利用 Map 是红黑树实现的特性,快速建立/查询索引。1022 Digital Library (30 point(s))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 as
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1023 Have Fun with Numbers (20 point(s))

思路:从后往前访问字符串,乘以2后入栈,统计相应 digit 出现的次数;计算栈的 digit 统计出现次数,如果两者不相同,则输出 No,否则输出 Yes最后输出翻倍后的字符串。1023 Have Fun with Numbers (20 point(s))Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1024 Palindromic Number (25 point(s))

思路:先判断是否回环数,如果不是,就首尾相加,然后再判断是否回环数。1024 Palindromic Number (25 point(s))A number that will be the same when it is written forwards or backwards is known as aPalindromic Number. For example, 1234321 is a palindromic number. All single digit numbers ar.
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1025 PAT Ranking (25 point(s))

思路:在全局,和局部下,记录对应分数有多少人,再排名1025 PAT Ranking (25 point(s))Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the rankl
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1026 Table Tennis (30 point(s))

思路:用两个队列,vip队列和普通队列,找到完成时间最早的窗口,如果比两个队列最早的人的到达时间还早,就更新窗口完成时间为两者最小值,然后回到开头重新找完成时间最早的窗口;若选中vip队列,则重新查找窗口,优先选 vip 窗口;若选中普通队列,则使用该窗口;注意:vip玩家,优先分配vip桌子 等待时间大于等于30秒,进一分钟,小于30秒则舍去的原则; 游戏时长不能超过 120 分钟1026 Table Tennis (30 point(s))A table tennis
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0

1027 Colors in Mars (20 point(s))

思路:模13和整除13的数学题。1027 Colors in Mars (20 point(s))People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are forRed, the middle 2 digi.
分类: 其他 发布时间: 02-26 08:49 阅读次数: 0