- 博客(31)
- 收藏
- 关注
原创 玲珑杯 1074 - Pick Up Coins (选硬币 || 区间DP)
DESCRIPTIONThere are n coins in a line, indexed from 0 to n-1. Each coin has its ownvalue.You are asked to pick up all the coins to get maximum value. If the you pickcoini (1 ≤ i ≤n-2), you
2016-12-26 20:17:41 579
原创 玲珑杯 1072 - Capture (树的操作)
In a city capture game, Mr. Van owns a Empire with a capital city ( marked 1 ). Initially, Mr. Van's Empire had the capital only. All other cities were captured by him in the game and each next captur
2016-12-25 13:59:06 308
原创 codeforce 742 E. Arpa’s overnight party and Mehrdad’s silent entering (分食物||二分图染色+dfs)
Note that girls in Arpa’s land are really attractive.Arpa loves overnight parties. In the middle of one of these parties Mehrdad suddenly appeared. He sawn pairs of friends sitting around a table.
2016-12-18 20:27:18 486
原创 codeforce B. Chloe and the sequence (递归)
Chloe, the same as Vladik, is a competitive programmer. She didn't have any problems to get to the olympiad like Vladik, but she was confused by the task proposed on the olympiad.Let's consider the
2016-12-17 20:43:42 389
原创 codeforce 743 D. Chloe and pleasant prizes (树形dp)
Generous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a prize for them on their own. Christmas is coming, so sponsors decided to decorate the Chr
2016-12-17 20:04:44 449
原创 codeforce 743 C. Vladik and fractions (数学构造)
Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integern he can represent fraction as a sum of three distinct positive fractions in form
2016-12-17 16:14:35 388
原创 codeforce 742 D. Arpa's weak amphitheater and Mehrdad's valuable Hoses (分组背包+并查集))
有关系的并查集分在一组~01背包~每组选一个或全选~更新最优解即可~~Just to remind, girls in Arpa's land are really nice.Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weightwi a
2016-12-17 13:08:37 550
原创 codeforces 735 D. Taxes (三素数||哥德巴赫猜想)
题意:就是把一个数字分解成质数,最少分几个。比如样例,4分为2+2,27分为17+3+7,当然质数本身就不用分了,直接输出1就行了。强哥德巴赫猜想 每个不小于 6 的偶数都是两个奇素数之和。弱哥德巴赫猜想 每个不小于 9 的奇数都是三个奇素数之和思路:那么如果是偶数,等于两个奇素数之和 如果是奇数,等于2+素数 或者 三个素数 Mr.
2016-12-16 21:20:51 555
原创 codeforce 735 C. Tennis Championship (斐波那契数列||网球比赛)
题意:问你冠军最多能赢多少场比赛,然后一个人只能和赢得场数最多相差一的人进行比赛,如果一个人输掉了比赛,那么他就失去了继续比赛的资格。思路:这题的突破口已经很明显暗示你了,最多相差一个人 才能进行比赛, 那我们可以考虑 冠军打n场比赛最少要几个人, 那么很容易想到这个一个斐波那契数列Famous Brazil city Rio de Janeiro holds a te
2016-12-16 21:14:10 360
原创 PAT 1096 Consecutive Factors (暴力,最大连续乘积)
Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3*5*6*7, where 5, 6, and 7 are the three consecutive numbers. Now given
2016-12-09 16:46:29 546
原创 PAT 1104 Sum of Number Segments (暴力DFS)
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)
2016-12-09 14:35:50 293
原创 1119. Pre- and Post-order Traversals (已知前序后续求中序)
Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal sequences, or preorder and inorder
2016-12-09 13:50:23 324
原创 1115. Counting Nodes in a BST (构建二叉排序树,输出最后两层的节点数)
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than or equal to the node's key.
2016-12-08 18:58:41 478
原创 PAT 1114. Family Property (并查集)
总结了一下PAT的题目,我们要静下心来,耐心的实现每一个细节,代码实现起来比较不会出bug并查集,我们可以一次一次完成,不要想着一部到位!!!This time, you are supposed to help us collect the data for family-owned property. Given each person's family
2016-12-08 14:37:34 740
原创 1110. Complete Binary Tree (判断完全二叉树)
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) w
2016-12-08 00:43:27 1294
原创 1109. Group Photo (模拟)
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 row must be N/K (round down to the nearest inte
2016-12-07 23:01:56 367
原创 1093. Count PAT's (统计PAT的个数)
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
2016-12-07 19:37:19 677
原创 1107. Social Clusters (并查集 )
When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. A "social cluster" is a set of people who have some of th
2016-12-07 19:06:48 332
原创 PAT 1105. Spiral Matrix (螺旋输出)
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
2016-12-07 11:38:44 397
原创 PAT 1020 已知中序后序,还原二叉树 (二叉树遍历问题)
1020. Tree Traversals (25)时间限制 400 ms内存限制 65536 kB代码长度限制 16000 B判题程序 Standard 作者 CHEN, YueSuppose that all the keys in a binary tree are distinct po
2016-12-07 00:32:29 627
原创 PAT 1089 (排序||归并,直接插入)
According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data,
2016-12-06 17:16:23 293
原创 PAT 1088 1088. Rational Arithmetic (模拟四则运算)
For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient.Input Specification:Each input file contains one test c
2016-12-06 15:27:08 192
原创 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 route with the least cost while gaining the most happiness.Input Specification:Each
2016-12-06 10:00:23 458
原创 PAT 1075. PAT Judge (排序,比较烦)
The ranklist of PAT is generated from the status list, which shows the scores of the submittions. This time you are supposed to generate the ranklist for PAT.Input Specification:Each input file co
2016-12-04 19:28:53 283
原创 PAT 1074. Reversing Linked List
Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, if K = 3, then you must output 3→2→1→6→5→4; if K
2016-12-04 12:22:24 188
原创 PAT 1072. Gas Station (求n次最短路)
A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must guarantee that all the hou
2016-12-03 20:37:49 362
原创 PAT 1064. Complete Binary Search Tree (二叉树遍历)
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node's key.The right
2016-12-03 11:51:31 336
原创 PAT 1063. Set Similarity (STL||集合交,并)
Given two sets of integers, the similarity of the sets is defined to be Nc/Nt*100%, where Nc is the number of distinct common numbers shared by the two sets, and Nt is the total number of distinct num
2016-12-03 10:48:16 309
原创 PAT 1051 Pop Sequence (出栈的合法性)
PAT1051:给定stack的容量,给定数据的入栈顺序:从1开始的正整数序列,在允许随机的出栈操作的情况下,要求判断某出栈序列是否可能。比如,告知stack容量为5,入栈序列的最大值为7。有两个序列需要判断合理性:1 2 3 4 5 6 7: 这个序列是可能的,只需每次入栈时都做出栈操作。3 2 1 7 5 6 4: 这个序列是不可能的,其中前半部分3 2 1是合法的,先将1
2016-12-02 13:16:58 449
原创 CSU 1809 括号匹配问题
DescriptionBobo has a balanced parenthesis sequence P=p 1 p 2…p n of length n and q questions. The i-th question is whether P remains balanced after p ai and p bi swapped. Note that quest
2016-12-02 00:17:34 316
原创 CSU 1803 a×b 是 2016 的倍数(枚举)
Description 给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量: 1. 1≤a≤n,1≤b≤m; 2. a×b 是 2016 的倍数。 Input输入包含不超过 30 组数据。 每组数据包含两个整数 n,m (1≤n,m≤10 9). Output对于每组数据,输出一个整
2016-12-02 00:02:46 719
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人