
算法
不是胖狐狸诶
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
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≤i≤j≤K. The Maximum Subsequence is the continuous subsequence which has the largest sum of its elements. For exampl原创 2020-07-24 22:32:39 · 184 阅读 · 0 评论 -
1149 Dangerous Goods Packaging (25分)
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 serious trouble. For example, oxidizing agent (氧化剂) must not be packed with flammable liquid (易燃液体), or it原创 2020-07-19 18:33:31 · 204 阅读 · 0 评论 -
1141 PAT Ranking of Institutions (25分)
After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the ranklist.Input Specification:Each input file contains one test case. For each case, the first line gives a原创 2020-07-19 15:19:24 · 227 阅读 · 0 评论 -
1137 Final Grading (25分)
For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/she must first obtain no less than 200 points from the online programming assignments, and then receive a原创 2020-07-19 09:50:10 · 262 阅读 · 0 评论 -
1004 Counting Leaves (30分)
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.Input Specification:Each input file contains one test case. Each case starts with a line containing 0<N<100, the number of nod原创 2020-07-18 18:30:03 · 222 阅读 · 0 评论 -
1003 Emergency (25分)
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 length of each road between any pair of cities are marked原创 2020-07-18 18:28:53 · 199 阅读 · 0 评论 -
1002 A+B for 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原创 2020-07-18 18:26:54 · 185 阅读 · 0 评论 -
1001 A+B Format (20分)
Calculate a+b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).Input Specification:Each input file contains one test case. Each case contains a pair o原创 2020-07-18 18:24:53 · 270 阅读 · 0 评论 -
1117 Eddington Number (25分)
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 -- that is, the maximum integer E such that it is for E days that one rides more than E miles. Eddington's own E原创 2020-07-18 18:16:47 · 202 阅读 · 0 评论 -
1140 Look-and-say Sequence (20分)
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)st number is a kind of description of the nth number. For example, the 2nd number means that there is o原创 2020-07-18 17:53:51 · 215 阅读 · 0 评论 -
1152 Google Recruitment (20分)
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 super-simple, a URL consisting of the first 10-digit prime found in consecutive digits of the natural constant原创 2020-07-18 11:33:43 · 231 阅读 · 0 评论 -
1132 Cut Integer (20分)
Cutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long integers A and B. For example, after cutting Z = 167334, we have A = 167 and B = 334. It is interesting to see that Z can be devided by the product of A and B,原创 2020-07-18 10:50:42 · 226 阅读 · 0 评论 -
1128 N Queens Puzzle (20分)
The "eight queens puzzle" is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other. Thus, a solution requires that no two queens share the same row, column, or diagonal. The eight queens puzzle is an examp原创 2020-07-18 09:50:36 · 159 阅读 · 0 评论 -
1124 Raffle for Weibo Followers (20分)
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 every N followers who forwarded his post, and give away gifts. Now you are supposed to help him generate t原创 2020-07-18 08:06:43 · 204 阅读 · 0 评论 -
1120 Friend Numbers (20分)
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 friend numbers since 1+2+3 = 5+1 = 6, and 6 is their friend ID. Given some numbers, you are supposed to count原创 2020-07-17 23:17:16 · 177 阅读 · 0 评论 -
1116 Come on! Let‘s C (20分)
"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 the contest is for fun, the award rules are funny as the following:0、 The Champion will receive a "Mystery原创 2020-07-17 23:04:26 · 257 阅读 · 0 评论 -
1113 Integer Set Partition (25分)
Given a set of N (>1) positive integers, you are supposed to partition them into two disjoint sets A1 and A2 of n1 and n2 numbers, respectively. Let S1 and S2 denote the sums of all the numbers in A1 and A2, respectively. You are原创 2020-07-17 22:00:00 · 234 阅读 · 0 评论 -
1112 Stucked Keyboard (20分)
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 repeatedly on screen for k times.Now given a resulting string on screen, you are supposed to list all the p原创 2020-07-17 20:50:12 · 234 阅读 · 0 评论 -
1110 Complete Binary Tree (25分)
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, the first line gives a positive integer N (≤20) which is the total number of nodes in the tree -- and henc原创 2020-07-17 16:44:45 · 183 阅读 · 0 评论 -
1104 Sum of Number Segments (20分)
Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence { 0.1, 0.2, 0.3, 0.4 }, we have 10 segments: (0.1) (0.1, 0.2) (0.1, 0.2, 0.3) (0.1, 0.2, 0.3, 0.4) (0.2) (0.2, 0.3) (0.2, 0.3, 0.4)原创 2020-07-16 23:44:55 · 357 阅读 · 1 评论 -
1106 Lowest Price in Supply Chain (25分)
A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone on the chain buys products from one's supplier in a price P a原创 2020-07-16 22:02:52 · 176 阅读 · 0 评论 -
1105 Spiral Matrix (25分)
This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix is filled in from the first element at the upper-left corner, then move in a clockwise spiral. The matrix has m rows and n columns原创 2020-07-16 18:51:59 · 182 阅读 · 1 评论 -
1094 The Largest Generation (25分)
A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the largest population.Input Specification:Each input file contains one test case.原创 2020-07-15 08:42:49 · 222 阅读 · 0 评论 -
1093 Count PAT‘s (25分)
The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, and the 6th characters.Now given any string, you are supposed to tell the number of原创 2020-07-15 07:38:31 · 234 阅读 · 0 评论 -
Cheese Aizu - 0558题解
チーズ ()問題今年も JOI 町のチーズ工場がチーズの生産を始め,ねずみが巣から顔を出した.JOI 町は東西南北に区画整理されていて,各区画は巣,チーズ工場,障害物,空き地のいずれかである.ねずみは巣から出発して全てのチーズ工場を訪れチーズを 1 個ずつ食べる.この町には,N 個のチーズ工場があり,どの工場も1種類のチーズだけを生産している.チーズの硬さは工場によって異なっており,硬...原创 2019-07-25 09:04:50 · 12782 阅读 · 0 评论 -
最大流和最小割问题
以下是根据个人的理解用大白话解释的定义:设有一个有向带边权图G,并确定图中一个结点作为源点(可以理解成起点),再确定另一个点作为汇点(可以理解成终点),在这个图中找到一个边集A,使得在这个图G中删掉A后有且仅有两个子图,且两个子图分别包含源点和汇点。其中这个点集A成为割集。当这个割集里的所有边的权值之和达到最小的时候,称其为最小割。从源点开始按照后一边的流量不得大于前一边(后一边和前一边之间由...原创 2019-05-17 23:44:21 · 1618 阅读 · 0 评论