自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Codeforces 118D Caesar's Legions

Gaius Julius Caesar, a famous general, loved to line up his soldiers. Overall the army hadn1 footmen andn2 horsemen. Caesar thought that an arrangement isnot beautiful if somewhere in the line t

2015-10-30 09:56:27 614

原创 POJ 3071 Football(0)

DescriptionConsider a single-elimination football tournament involving 2n teams, denoted 1, 2, …, 2n. In each round of the tournament, all teams still in the tournament are placed in a list in o

2015-10-10 17:58:25 373

原创 HDU 4035 Maze

http://acm.hdu.edu.cn/showproblem.php?pid=4035经典概率DP。#include #include #include #include #include #include #include #include #include #include using namespace std;const int maxn = 100

2015-10-10 15:58:44 377

原创 HDU 4089 E - Activation(2)

DescriptionAfter 4 years' waiting, the game "Chinese Paladin 5" finally comes out. Tomato is a crazy fan, and luckily he got the first release. Now he is at home, ready to begin his journey.Bu

2015-10-10 11:30:34 634

原创 Codeforces 584E Anton and Ira

Anton loves transforming one permutation into another one by swapping elements for money, and Ira doesn't like paying for stupid games. Help them obtain the required permutation by paying as little mo

2015-10-08 23:19:46 1284 3

原创 HDU 5497 Inversion

Problem DescriptionYou have a sequence {a1,a2,...,an} and you can delete a contiguous subsequence of length m. So what is the minimum number of inversions after the deletion. InputTher

2015-10-08 21:28:36 515

原创 HDU 2294 Pendant

Problem DescriptionOn Saint Valentine's Day, Alex imagined to present a special pendant to his girl friend made by K kind of pearls. The pendant is actually a string of pearls, and its length is def

2015-10-08 15:56:49 494

原创 Codeforces 582B Once Again...

You are given an array of positive integers a1, a2, ..., an × T of length n × T. We know that for any i > n it is true that ai = ai - n. Find the length of the longest non-decreasing sequence of

2015-10-08 11:02:34 511

原创 Codeforces 582A GCD Table

The GCD table G of size n × n for an array of positive integers a of length n is defined by formulaLet us remind you that the greatest common divisor (GCD) of two positive integers x and y i

2015-10-06 12:05:48 608

原创 HDU 5481 Desiderium

Problem DescriptionThere is a set of intervals, the size of this set is n.If we select a subset of this set with equal probability, how many the expected length of intervals' union of this sub

2015-09-28 16:04:28 495

原创 Codeforces 568A Primes or Palindromes?

Rikhail Mubinchik believes that the current definition of prime numbers is obsolete as they are too complex and unpredictable. A palindromic number is another matter. It is aesthetically pleasing, and

2015-09-28 09:53:34 483

原创 Codeforces 405C Unusual Product

Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n i

2015-09-25 17:44:29 379

原创 Codeforces 546D Soldier and Number Game

Two soldiers are playing a game. At the beginning first of them chooses a positive integer n and gives it to the second soldier. Then the second one tries to make maximum possible number of rounds.

2015-09-25 10:12:12 581

原创 HDU 5465 Clarke and puzzle

这题,我真草他妈了,一眼就秒的题,我草复测竟然TLE了,我草,早知道我把update改成n,m了,我去,打了这三场比赛我是涨记性了,以后打的时候就得注意细节,细节,细节,细节,。。。。。。。我真草了,好不容易一次上分的机会,我去。。。。。。。。我。。。。。。。。。。。。。#include #include #include #include #include #include

2015-09-20 00:21:21 589

原创 POJ 2151 Check the difficulty of problems

DescriptionOrganizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the contest result satisfy the following two terms: 1. Al

2015-09-19 20:27:41 400

原创 ZOJ 3329 One Person Game(1)

DescriptionThere is a very simple and interesting one-person game. You have 3 dice, namelyDie1, Die2 and Die3. Die1 hasK1 faces. Die2 has K2 faces.Die3 has K3 faces. All the dice are fair di

2015-09-19 16:26:04 408

原创 POJ 2096 Collecting Bugs(0)

DescriptionIvan is fond of collecting. Unlike other people who collect post stamps, coins or other material stuff, he collects software bugs. When Ivan gets a new program, he classifies all possib

2015-09-19 11:32:33 344

原创 POJ 3744 Scout YYF I

DescriptionYYF is a couragous scout. Now he is on a dangerous mission which is to penetrate into the enemy's base. After overcoming a series difficulties, YYF is now at the start of enemy's famous

2015-09-19 10:40:34 432

原创 Codeforces 578C Weakness and Poorness

You are given a sequence of n integers a1, a2, ..., an.Determine a real number x such that the weakness of the sequence a1 - x, a2 - x, ..., an - x is as small as possible.The weakness of a

2015-09-17 14:47:59 822

转载 《Hamiltonian Cycle》题目分析

题意分析给定一个有向图,求图中哈密顿回路的数量。算法分析哈密顿回路,具体到本题中即从某一个点开始经过所有的点一次后再回到该点的不同路径数。对于这个不同需要注意两点:如果我们将路径经过的点按顺序写下,比如当n=3时,若存在123和231。此时,我们认为这两条路径是同一条哈密顿回路。而123和213则是不同的哈密顿回路。若两个点之间有多条边,经过不同的边的路

2015-09-16 15:45:54 944

转载 Fleury(弗罗莱)算法求欧拉路径

上面是摘自图论书上的定义。算法在运行过程中删除了所有已走的路径,也就是说途中残留了所有没有行走的边。根据割边的定义,如果在搜索过程中遇到割边意味着当前的搜索路径需要改进,即提前输出某一个联通子集的访问序列,这样就能够保证访问完其中联通子图中后再通过割边访问后一个联通子图,最后再沿原路输出一开始到达该点的路径。如果只有割边可以扩展的话,只需要考虑先输出割边的另一部分联通子集访问序列。

2015-09-16 15:44:42 828

原创 POJ 2327 Dumb Bones

DescriptionYou are trying to set up a straight line of dominos, standing on end, to be pushed over later for your entertainment. (Sure, it seems pointless to set something up only to knock it down

2015-09-15 21:50:28 891

原创 POJ 2088 Long Night of Museums

DescriptionThe city of Vienna is called the "City of Culture" because (among other things) there are more than 100 museums in the city. As a consequence, it is very difficult (and very expensive)

2015-09-13 11:47:12 835

原创 POJ 2686 Traveling by Stagecoach

Once upon a time, there was a traveler. He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this prob

2015-09-13 10:09:12 370

原创 Codeforces 295A Greg and Array

Greg has an array a = a1, a2, ..., an and m operations. Each operation looks as: li, ri, di, (1 ≤ li ≤ ri ≤ n). To apply operation i to the array means to increase all array elements with numbers 

2015-09-12 18:56:02 555

原创 POJ 3411 Paid Roads

DescriptionA network of m roads connects N cities (numbered from 1 toN). There may be more than one road connecting one city with another. Some of the roads are paid. There are two ways to pay

2015-09-12 17:43:59 364

原创 Codeforces 464A No to Palindromes!

Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet ands doesn't contain any palindrome contiguous substring o

2015-09-11 22:44:04 504

原创 Codeforces 282C XOR and OR

The Bitlandians are quite weird people. They do everything differently. They have a different alphabet so they have a different definition for a string.A Bitlandish string is a string made only of

2015-09-11 21:55:39 484

原创 Codeforces 527C Glass Carving

Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangularw mm  ×  h mm sheet of glass, a diamond glass cutter and lots of

2015-09-09 16:40:03 735

原创 Codeforces 383A Milking cows

Iahub helps his grandfather at the farm. Today he must milk the cows. There are n cows sitting in a row, numbered from 1 to n from left to right. Each cow is either facing to the left or facing to t

2015-09-09 12:03:17 383

原创 Codeforces 276C Little Girl and Maximum Sum

The little girl loves the problems on array queries very much.One day she came across a rather well-known problem: you've got an array of n elements (the elements of the array are indexed starting f

2015-09-08 21:16:34 947

原创 POJ 1699 Best Sequence

The twenty-first century is a biology-technology developing century. One of the most attractive and challenging tasks is on the gene project, especially on gene sorting program. Recently we know that

2015-09-07 22:36:48 477

原创 POJ 2836 Rectangular Covering

n points are given on the Cartesian plane. Now you have to use some rectangles whose sides are parallel to the axes to cover them. Every point must be covered. And a point can be covered by several re

2015-09-07 21:33:57 442

原创 POJ 2541 Binary Witch

Once upon a time in the silent depths of digital forests there lived a Binary Witch. She was able to forecast weather, telling for any day in the future whether it will be rainy or sunny.Her mag

2015-09-07 18:05:13 452

原创 POJ 2436 Disease Management

DescriptionAlas! A set of D (1 <= D <= 15) diseases (numbered 1..D) is running through the farm. Farmer John would like to milk as many of his N (1 <= N <= 1,000) cows as possible. If the milked c

2015-09-07 16:23:36 556

原创 Codeforces 347C Alice and Bob

题目链接: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=46782解题思路:首先对于a和b,如果b>a且gcd(a,b)=1的话,则按照游戏规则可以求解出1->b之间的所有整数,每次操作只能增加一个整数。因此我们可以先求解出所有数的最大公约数,用最大的数除以最大公约数d则可以得到我们能够继续添加的数的数目,

2015-09-07 11:21:59 787

原创 Codeforces 476C Dreamoon and Sums

Dreamoon loves summing up something for no reason. One day he obtains two integersa and b occasionally. He wants to calculate the sum of allnice integers. Positive integer x is called nice if a

2015-09-06 11:14:48 523

原创 BestCoder Round #54 (div.1) ($) Reflect

题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=627&pid=1004其实求解出前N=1,2,3,4时的数据便可以找出规律即为n+1的欧拉函数。解题报告的理论分析:mark一下

2015-09-05 21:21:08 401

原创 Codeforces 513B Permutations

You are given a permutation p of numbers 1, 2, ..., n. Let's define f(p) as the following sum:Find the lexicographically m-th permutation of length n in the set of permutations having the ma

2015-09-04 20:35:36 581

原创 Codeforces 274A k-Multiple Free Set

A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x y) from the set,

2015-09-04 17:29:26 686

空空如也

空空如也

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

TA关注的人

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