自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Coldfresh的博客

keeeeeep!~

  • 博客(407)
  • 收藏
  • 关注

原创 Lost Cows POJ - 2182(树状数组)

N (2 <= N <= 8,000) cows have unique brands in the range 1..N. In a spectacular display of poor judgment, they visited the neighborhood ‘watering hole’ and drank a few too many beers before dinn...

2018-04-06 14:04:42 373

原创 A Simple Problem with Integers POJ - 3468(树状数组)

You have N integers, A1, A2, … , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the su...

2018-04-06 11:18:47 254

原创 Addition Chains POJ - 2248(加深迭代搜索)

An addition chain for n is an integer sequence with the following four properties: a0 = 1 am = n a0 < a1 < a2 < … < am-1 < am For each k (1<=k<=m) there exist two (not nec...

2018-04-05 15:34:13 220

原创 In Touch HDU- 5361(最短路+并查集)

There are n soda living in a straight line. soda are numbered by 1,2,…,n from left to right. The distance between two adjacent soda is 1 meter. Every soda has a teleporter. The teleporter of i-th soda...

2018-04-05 14:37:10 337

原创 Pagodas HDU - 5512 (数论)

n pagodas were standing erect in Hong Jue Si between the Niushou Mountain and the Yuntai Mountain, labelled from 1 to n. However, only two of them (labelled a and b, where 1≤a≠b≤n) withstood the test ...

2018-04-04 17:54:35 223

原创 Parity game POJ - 1733 (离散化+种类并查集)

Now and then you play the following game with your friend. Your friend writes down a sequence consisting of zeroes and ones. You choose a continuous subsequence (for example the subsequence from the t...

2018-04-04 17:40:00 172

原创 Supermarket POJ - 1456 (堆)

A supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units starting from the moment the s...

2018-04-01 22:58:09 359

原创 历届试题 小朋友排队(蓝桥)

问题描述   n 个小朋友站成一排。现在要把他们按身高从低到高的顺序排列,但是每次只能交换位置相邻的两个小朋友。  每个小朋友都有一个不高兴的程度。开始的时候,所有小朋友的不高兴程度都是0。  如果某个小朋友第一次被要求交换,则他的不高兴程度增加1,如果第二次要求他交换,则他的不高兴程度增加2(即不高兴程度为3),依次类推。当要求某个小朋友第k次交换时,他的不高兴程度增加k。  请问...

2018-03-30 21:50:32 252

原创 莫比乌斯反演问题若干

因为接触到了积性函数的线性筛的问题,之前有过类似问题但是不够系统,所以想把遇到过的所有的反演问题的问题记录一下。 问题1: 求ans=∑aN∑bMgcd(a,b)ans=∑aN∑bMgcd(a,b)ans=\sum_a^N\sum_b^Mgcd(a,b) 这个问题比较经典啦。 设f(d)为gcd(x,y)为d的对数,F(d)为d|gcd(x,y)的对数f(d)为gcd(x,y)为d的对数,...

2018-03-30 12:41:51 427

原创 Finals in arithmetic CodeForces - 625D (构造)

Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovn...

2018-03-30 10:30:24 234

原创 Hamiltonian Spanning Tree CodeForces - 618D (思维)

A group of n cities is connected by a network of roads. There is an undirected road between every pair of cities, so there are roads in total. It takes exactly y seconds to traverse any single road....

2018-03-29 23:03:04 195

原创 Leonardo's Notebook POJ - 3128(置换群的开方判断)

— I just bought Leonardo’s secret notebook! Rare object collector Stan Ucker was really agitated but his friend, special investigator Sarah Kepticwas unimpressed. — How do you know it is genuine? ...

2018-03-28 21:50:55 278

原创 Naptime POJ - 2228(环形dp处理)

Goneril is a very sleep-deprived cow. Her day is partitioned into N (3 <= N <= 3,830) equal time periods but she can spend only B (2 <= B < N) not necessarily contiguous periods in bed. Du...

2018-03-28 20:00:19 390

原创 Yet Another Game of Stones ZOJ - 3964 (博弈)

Alice and Bob are playing yet another game of stones. The rules of this game are as follow:The game starts with n piles of stones indexed from 1 to n. The i-th pile contains ai stones and a special ...

2018-03-28 16:01:58 292

原创 Accumulation Degree POJ - 3585 (树形dp)(二次扫描和换根法)

Trees are an important component of the natural landscape because of their prevention of erosion and the provision of a specific ather-sheltered ecosystem in and under their foliage. Trees have also b...

2018-03-26 16:09:35 1557

原创 最小乘积(基本型) 贪心

问题描述   给两组数,各n个。   请调整每组数的排列顺序,使得两组数据相同下标元素对应相乘,然后相加的和最小。要求程序输出这个最小值。   例如两组数分别为:1 3  -5和-2 4 1  那么对应乘积取和的最小值应为:   (-5) * 4 + 3 * (-2) + 1 * 1 = -25 输入格式   第一个行一个数T表示数据组数。后面每组数据,先读入一个n,接下来两行每行...

2018-03-25 16:19:34 1165

原创 最大的算式 蓝桥

问题描述   题目很简单,给出N个数字,不改变它们的相对位置,在中间加入K个乘号和N-K-1个加号,(括号随便加)使最终结果尽量大。因为乘号和加号一共就是N-1个了,所以恰好每两个相邻数字之间都有一个符号。例如:   N=5,K=2,5个数字分别为1、2、3、4、5,可以加成:   1*2*(3+4+5)=24   1*(2+3)*(4+5)=45   (1*2+3)*(4+5)=45 ...

2018-03-25 16:07:22 437

原创 Network POJ - 3417(倍增LCA+树上差分)

Yixght is a manager of the company called SzqNetwork(SN). Now she’s very worried because she has just received a bad news which denotes that DxtNetwork(DN), the SN’s business rival, intents to attack ...

2018-03-24 19:38:08 253

原创 How far away ? HDU - 2586(倍增实现的LCA)

There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this “How far is it if I want to go from house A to house B”? Usually it hard to...

2018-03-23 23:50:42 455

原创 The Union of k-Segments CodeForces - 612D (思维)

You are given n segments on the coordinate axis Ox and the number k. The point is satisfied if it belongs to at least k segments. Find the smallest (by the number of segments) set of segments on the c...

2018-03-22 22:40:44 190

原创 Telephone Lines POJ - 3662(spfa+二分)

Farmer John wants to set up a telephone line at his farm. Unfortunately, the phone company is uncooperative, so he needs to pay for some of the cables required to connect his farm to the phone system....

2018-03-22 13:46:09 272

原创 1137 计算系数(组合数)

给定一个多项式(ax + by)^k,请求出多项式展开后x^n y^m项的系数。输入描述 Input Description 共一行,包含 5 个整数,分别为a,b,k,n,m,每两个整数之间用一个空格隔开。输出描述 Output Description 输出共 1 行,包含一个整数,表示所求的系数,这个系数可能很大,输出对10007 取模后的结果。样例输入 Sample Inpu...

2018-03-21 20:39:00 3222

原创 Minimum spanning tree for each edge CodeForces - 609E(ST算法+树链剖分(或倍增LCA)+最小生成树)

Connected undirected weighted graph without self-loops and multiple edges is given. Graph contains n vertices and m edges.For each edge (u, v) find the minimal possible weight of the spanning tree t...

2018-03-21 13:49:34 321

原创 余数之和 HYSBZ - 1257

给出正整数n和k,计算j(n, k)=k mod 1 + k mod 2 + k mod 3 + … + k mod n的值 其中k mod i表示k除以i的余数。 例如j(5, 3)=3 mod 1 + 3 mod 2 + 3 mod 3 + 3 mod 4 + 3 mod 5=0+1+0+3+3=7 Input 输入仅一行,包含两个整数n, k。 1<=n ,k<=10^...

2018-03-20 21:47:53 299

原创 Sticks POJ - 1011(枚举+dfs)

George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had orig...

2018-03-20 17:30:17 250

原创 Best Cow Fences POJ - 2018(经典二分)

Farmer John’s farm consists of a long row of N (1 <= N <= 100,000)fields. Each field contains a certain number of cows, 1 <= ncows <= 2000. FJ wants to build a fence around a contiguous ...

2018-03-19 21:31:18 1947 1

原创 New Year Tree CodeForces - 620E(dfs序+线段树)

The New Year holidays are over, but Resha doesn’t want to throw away the New Year tree. He invited his best friends Kerim and Gural to help him to redecorate the New Year tree.The New Year tree is a...

2018-03-19 18:11:27 284

原创 Sumdiv POJ - 1845(分治+素数筛+快速幂)

Consider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901). Input The only line contains the two natural n...

2018-03-18 22:51:39 186

原创 (pat)A1135. Is It A Red-Black Tree

There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties:(1) Every node is either red or black. (2) The root is black. (3) Every...

2018-03-14 19:58:07 389

原创 (pat)A1127. ZigZagging on a Tree

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. And it is a simple stand...

2018-03-14 12:03:08 267

原创 (pat)A1119. 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 ...

2018-03-14 09:56:47 302

原创 (pat)A1115. Counting Nodes in a BST

Counting Nodes in a BST (30) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue A Binary Search Tree (BST) is recursively defined as a binary tree which has the following ...

2018-03-13 18:30:17 201

原创 (pat)A1107. 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...

2018-03-13 17:50:18 243

原创 (pat)A1103. Integer Factorization

The K-P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are supposed to write a program to find the K-P factorization of N for any positive...

2018-03-13 16:50:09 291

原创 (pat)A1068. Find More Coins

Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. However,...

2018-03-12 20:48:58 166

原创 (pat)A1064. Complete Binary Search Tree

A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:1.The left subtree of a node contains only nodes with keys less than the node’s key. 2.The righ...

2018-03-12 19:12:49 305

原创 (pat)A1014. Waiting in Line

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:1.The spa...

2018-03-10 16:25:26 218

原创 (pat)A1004. Counting Leaves

A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. InputEach input file contains one test case. Each case starts with a line co...

2018-03-10 14:11:36 241

原创 (pat)A1087. 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 ...

2018-03-10 13:37:26 385

原创 (pat)A1013. Battle Over Cities

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 nee...

2018-03-09 11:57:27 202

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除