自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(188)
  • 收藏
  • 关注

原创 Machine Schedule POJ - 1325 二分匹配 最小点覆盖数

As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Scheduling problems differ widely in the nature of the constraints that...

2018-08-29 11:21:54 232

转载 Place the Robots ZOJ - 1654 二分图匹配最大独立集

Robert is a famous engineer. One day he was given a task by his boss. The background of the task was the following:Given a map consisting of square blocks. There were three kinds of blocks: Wall, Gra...

2018-08-29 10:22:46 272

原创 食物链 并查集加权

动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第二种说法是"2 X Y",表示X吃Y。 此人对N个动物,用上述两种说法,一句接一句地说出K句话...

2018-08-28 10:14:51 443

转载 Team Formation

For an upcoming programming contest, Edward, the headmaster of Marjar University, is forming a two-man team from N students of his university.Edward knows the skill level of each student. He has fou...

2018-08-22 23:22:34 228

原创 String of CCPC 思维,字符串,细节

BaoBao has just found a string  of length  consisting of 'C' and 'P' in his pocket. As a big fan of the China Collegiate Programming Contest, BaoBao thinks a substring  of  is "good", if and only if  ...

2018-08-22 10:31:46 635

转载 ZOJ-3993 Safest Buildings

题意:在一个半径为R的大圈里会随机的刷出半径为r的安全区,这个小圆(半径r)一定在大圆内(半径R),给n个建筑物,要求输出安全率最高的建筑的数目和编号思路: 第一点:以每一个建筑为圆心,以r为半径作一个圆O1,这个圆O1内或者圆上的点都可以它本身为圆心,以r为半径作一个圆O2使这个建筑在这个圆O2内(安全区内),所以题目可以转化为 看哪个建筑的圆O1的面积大。如图A,B两个建筑物,明显A的圆...

2018-08-22 07:01:56 228

转载 Inversion Sequence 线段树通过逆序数还原原序列

For sequence i1, i2, i3, … , iN, we set aj to be the number of members in the sequence which are prior to j and greater to j at the same time. The sequence a1, a2, a3, … , aN is referred to as the inv...

2018-08-21 08:07:49 349

原创 2148: 梦皮神

http://acm.csu.edu.cn/csuoj/problemset/problem?pid=2148 题意     正N边形每个顶点有一个分身以固定的速率向其中一侧的点靠近,中心的人可移动也可以不动,问最坏情况下分身什么时候遇到中心的人 分析     最坏情况下中心的人显然是在原地等皮神的     点在移动的过程中始终保持着原来的形状,即正 N 边形。因为它们 都是以顺时针的点作...

2018-08-20 11:50:17 209

原创 F - Friends 大数素数判断(拉宾米勒测试)+二分图匹配

On an alien planet, every extraterrestrial is born with a number. If the sum of two numbers is a prime number, then two extraterrestrials can be friends. But every extraterrestrial can only has at mos...

2018-08-19 18:52:17 351

转载 Navigition Problem

Navigation is a field of study that focuses on the process of monitoring and controlling the movement of a craft or vehicle from one place to another. The field of navigation includes four general cat...

2018-08-19 18:38:59 257

原创 Idiomatic Phrases Game 成语接龙 dijstra

Tom is playing a game called Idiomatic Phrases Game. An idiom consists of several Chinese characters and has a certain meaning. This game will give Tom two idioms. He should build a list of idioms and...

2018-08-19 15:35:42 301

原创 Palindromes

A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a palindrome because it is the same when the string is read from lef...

2018-08-19 12:17:01 898

转载 康托展开 已知一个排列,求这个排列在全排列中是第几个 康托展开逆运算:已知在全排列中排第几,求这个排列

The isolated people of MacGuffin Island have a unique culture, and one of the most interesting things about them is their language. Their alphabet consists of the first 9 letters of the Roman alphabet...

2018-08-19 01:08:24 845

原创 鸽笼原理 HDU - 1808 组合数学

Every year there is the same problem at Halloween: Each neighbour is only willing to give a certain total number of sweets on that day, no matter how many children call on him, so it may happen that a...

2018-08-19 00:25:34 331

原创 csu 1554: SG Value

The SG value of a set (multiset) is the minimum positive integer that could not be constituted of the number in this set.You will be start with an empty set, now there are two opertions:1. insert a ...

2018-08-18 19:14:08 190

原创 Design road 三分 多条河 陆地 建桥

You need to design road from (0, 0) to (x, y) in plane with the lowest cost. Unfortunately, there are N Rivers between (0, 0) and (x, y).It costs c1 Yuan RMB per meter to build road, and it costs c2 Y...

2018-08-18 17:02:40 280

原创 Simple String

Welcome,this is the 2015 3th Multiple Universities Programming Contest ,Changsha ,Hunan Province. In order to let you feel fun, ACgege will give you a simple problem. But is that true? OK, let’s enjoy...

2018-08-18 13:12:21 241

原创 Benny's Compiler

These days Benny has designed a new compiler for C programming language. His compilation system provides a compiler driver that invokes the language preprocessor, compiler, assembler and linker. C sou...

2018-08-17 16:58:50 346

原创 Eular质数筛法 O(n)的素素筛选法

#include<iostream>#include<cstdio>#include<bits/stdc++.h>using namespace std;int isPrim[1000010],primeList[1000010],primeCount=0;int main(){ memset(isPrim,-1,sizeof(isPrim...

2018-08-16 21:04:18 283

原创 2018/8/16

http://acm.hnucm.edu.cn/vjudge/contest/view.action?cid=32#overview今天的题目大多数和算法没关系,关键还是看你的观察力,不管是从Count 101的字符串还是Taking Pebbles的胜利者都市要求分析出数据间的规律然后采用合适的方法解决,就算是Last Digit 数据看起来很吓人,但要求的时个位上的数字,求余之...

2018-08-16 19:18:09 271

原创 Taking Pebbles

There is a pile of N pebbles initially. Alice and Bob are playing a taking pebbles game as follows:    Alice and Bob moves by turns, Alice moves first. For each move, the player can takes away at lea...

2018-08-16 19:11:37 198

转载 To Add Which?

    There is an integer sequence with N integers. You can use 1 unit of cost to increase any integer in the sequence by 1.    Could you tell us the least units of cost to achieve that, the absolute v...

2018-08-16 17:14:54 180

原创 Count 101

You know YaoYao is fond of his chains. He has a lot of chains and each chain has n diamonds on it. There are two kinds of diamonds, labeled 0 and 1. We can write down the label of diamonds on a chain....

2018-08-16 15:14:31 239

原创 Last Digit 快速幂 取余

   The function f(n, k) is defined by f(n, k) = 1k + 2k + 3k +...+ nk. If you know the value of n and k, could you tell us the last digit of f(n, k)?    For example, if n is 3 and k is 2, f(n, k) = f...

2018-08-16 14:20:06 311

原创 Quoit Design

20 01 121 11 13-1.5 00 00 1.50给你n个平面上的坐标,求平面上的最近点对的距离的一半关键是求最近点对。如果直接遍历,时间会很大,所以这里分治,将坐标按x轴排序,然后将点以mid为中线分为左右两部分,左边最小为点距为d1,右边最小点距为d2从中取最小值赋值给rad作为新的最小点距。然而,到目前为止,最小点距还有可能是来自分布在mid两...

2018-08-15 20:20:23 703

原创 Number Sequence

A number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to calculate the value of f(n). InputThe input consists of mu...

2018-08-15 12:33:05 256

原创 hdu3577 Fast Arrangement

Chinese always have the railway tickets problem because of its' huge amount of passangers and stations. Now goverment need you to develop a new tickets query system. One train can just take k passang...

2018-08-14 18:51:33 193

原创 POJ 3468 A Simple Problem with Integers 区间更新

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

2018-08-14 15:37:55 156

原创 Just a Hook

用线段树对一个区间的所有树进行更新所进行的操作与利用线段树对一个区间的单间进行更新的操作有所不同。单点更新时先找到要更新的点,然后再向上回溯,将祖先更新。而对整个区间的数据进行更新时如此这般,效率会很低。所以当我们区间更新时,当从根节点向下不断缩小区间时,一旦锁定了区间就直接计算出该区间更新后的值,然后给该节点打上lazy标志,接着不会继续向下更新,而是向上回溯更新祖先节点,而laz...

2018-08-14 15:11:12 181

原创 Cyclic Nacklace HDU - 3746

CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinking about how to...

2018-08-13 17:00:46 156

原创 Oulipo HDU - 1686

The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais tout s’...

2018-08-13 15:41:12 155

转载 Period HDU - 1358

For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2 ...

2018-08-13 14:20:31 244

原创 Blue Jeans POJ - 3080

The Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hundreds of thousands of contributors to map how the Earth was populated. ...

2018-08-13 11:07:06 130

转载 Clock Pictures CSU - 1581 kmp变形应用

 Input Output Sample Input61 2 3 4 5 67 6 5 4 3 1Sample Outputimpossible给你两个钟,每一个钟上有n个指针,现在告诉你这些指针的角度,问你两个钟表的指针是否有可能重合。把角度排序,然后相邻的指针求差,但最后的指针与第一个指针的角度差是mod-(a[n-1]-a[0]...

2018-08-13 09:44:55 165

转载 Number Sequence HDU - 1711 kmp

Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] = b[1], a[K ...

2018-08-12 21:00:48 210

转载 Minimum Inversion Number

The inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i < j and ai > aj. For a given sequence of numbers a1, a2, ..., an, if we move the f...

2018-08-12 14:36:06 158

原创 Binary Tree Traversals 二叉树

A binary tree is a finite set of vertices that is either empty or consists of a root r and two disjoint binary trees called the left and right subtrees. There are three most important ways in which th...

2018-08-12 12:15:40 744

转载 FZU 1914 Funny Positive Sequence

There are n integers a 1,a 2,…,a n-1,a n in the sequence A, the sum of these n integers is larger than zero. There are n integers b 1,b2,…,b n-1,b n in the sequence B, B is the generating sequence of ...

2018-08-12 08:24:44 147

原创 敌兵布阵 线段树

C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 中央情报局要研究敌人究竟演习什么战术,所...

2018-08-11 12:22:40 152

原创 Crossing River

A group of N people wishes to go across a river with only one boat, which can at most carry two persons. Therefore some sort of shuttle arrangement must be arranged in order to row the boat back and f...

2018-08-08 10:17:14 1105

空空如也

空空如也

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

TA关注的人

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