自定义博客皮肤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 166E Tetrahedron

You are given a tetrahedron. Let's mark its vertices with letters A, B, C and D correspondingly.An ant is standing in the vertex D of the tetrahedron. The ant is quite active and he wouldn't sta

2015-08-31 21:33:16 1080

原创 Codeforces 474D Flowers

We saw the little game Marmot made for Mole's lunch. Now it's Marmot's dinner time and, as we all know, Marmot eats flowers. At every dinner he eats some red and white flowers. Therefore a dinner can

2015-08-31 20:59:32 788

原创 Codeforces 437C The Child and Toy

On Children's Day, the child got a toy from Delayyy as a present. However, the child is so naughty that he can't wait to destroy the toy.The toy consists of n parts and m ropes. Each rope links

2015-08-31 09:42:01 512

原创 Codeforces 377A Maze

Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side.

2015-08-26 21:16:16 1060

原创 Codeforces 484A Bits

Let's denote as  the number of bits set ('1' bits) in the binary representation of the non-negative integer x.You are given multiple queries consisting of pairs of integers l and r. For each q

2015-08-26 16:44:30 460

原创 Codeforces 466C Number of Ways

You've got array a[1], a[2], ..., a[n], consisting of n integers. Count the number of ways to split all the elements of the array into three contiguous parts so that the sum of elements in each part

2015-08-24 22:47:34 1199

原创 POJ 1064 Cable master

Cable masterTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 29484 Accepted: 6231DescriptionInhabitants of the Wonderland have decided to hold a regional

2015-07-28 11:28:02 262

原创 1153 选择子序列

长度为N的整数数组A,所有的数均不相同,假设下标从0开始。找到一个最长的数组B,B数组的长度为K,数值范围是0 - N - 1,记录的是A数组的下标。满足A[B[0]] > A[B[1]] > A[B[2]] >...A[B[K]],并且对任意连续的两项B[i]及B[i + 1],满足min(B[i],B[i + 1]) < j < max(B[i],B[i + 1]) 均有A[j]

2015-07-07 19:00:46 774

原创 牛顿迭代法

目前接触到的牛顿迭代法主要应用于两个方面:(1)方程求根问题(2)最优化问题。1、求解方程。并不是所有的方程都有求根公式,或者求根公式很复杂,导致求解困难。利用牛顿法,可以迭代求解。原理是利用泰勒公式,在x0处展开,且展开到一阶,即f(x) = f(x0)+(x-x0)f'(x0)求解方程f(x)=0,即f(x0)+(x-x0)*f'(x0)=0,求解x = x1=

2015-07-07 10:40:49 5471

原创 Manipulative Numbers

Problem StatementSuppose that A is a list of n numbers {A1,A2,A3,…,An} and B={B1,B2,B3,..,Bn} is a permutation of these numbers, we say B is K-Manipulative if and only if:M(B)=minimum(

2015-07-05 19:18:00 988

原创 String Transmission

Problem StatementBob has received a binary string of length N transmitted by Alice. He knows that due to errors in transmission, up to K bits might have been corrupted (and hence flipped). Howev

2015-07-05 16:49:41 944

原创 1112 KGold

给出N个人在0时刻的财富值M[i](所有人在0时刻的财富互不相等),以及财富增长速度S[i],随着时间的推移,某些人的财富值会超越另外一些人。如果时间足够长,对于财富增长最快的人来说,他的财富将超越所有其他对手。求发生的前10000次超越,分别是谁超过了谁?如果总的超越次数不足10000,则输出所有超越,如果1次超越都不会发生,则输出No Solution。输出按照超越发生的时间排序,同一

2015-07-05 09:48:41 823

转载 组合数取模

复习了一下组合数取模,当然推荐查看ACDreamer的博客啦,写的确实好啦,自己把里面的题目全A掉了。原文地址:http://blog.csdn.net/acdreamers/article/details/8037918http://acm.fzu.edu.cn/problem.php?pid=2020#include #include #include #

2015-07-03 15:29:57 421

原创 Xoring Ninja

Problem Statement给定一个长度为N的集合,对其进行XOR_SUM(异或和)运算,定义为:计算它每个非空子集进行异或运算的结果之和,输出这个和% 109 + 7的结果。一个集合的异或结果是其中所有元素的异或运算的结果例如,集合{A,B,C}异或的结果 = ((A^B)^C), 其中 ^ 表示 异或运算XOR。因此, 对包含3个元素的集合A = {X1,

2015-07-03 15:25:33 689

原创 距离之和最小 V3

X轴上有N个点,每个点除了包括一个位置数据X[i],还包括一个权值W[i]。该点到其他点的带权距离 = 实际距离 * 权值。求X轴上一点使它到这N个点的带权距离之和最小,输出这个最小的带权距离之和。Input第1行:点的数量N。(2 <= N <= 10000)第2 - N + 1行:每行2个数,中间用空格分隔,分别是点的位置及权值。(-10^5 Outp

2015-07-02 21:55:14 706

原创 循环赛日程表问题

相信循环日程表问题大家都不陌生,我们很容易想到一个分治的方法来求解此问题,今天碰巧遇到了一种非递归的解法,mark一下,该解法是利用多边形来进行求解的,具体的求解过程参照此博客:http://blog.csdn.net/yuanyirui/article/details/3891359,他在解决8人的循环日程表的时候采用的是七边形,我在图上画了一下我们完全可以在参加循环赛的人数为n时利用n边形的求

2015-06-30 12:11:25 426

原创 1105 第K大的数

数组A和数组B,里面都有n个整数。数组C共有n^2个整数,分别是A[0] * B[0],A[0] * B[1] ......A[1] * B[0],A[1] * B[1]......A[n - 1] * B[n - 1](数组A同数组B的组合)。求数组C中第K大的数。例如:A:1 2 3,B:2 3 4。A与B组合成的C包括2 3 4 4 6 8 6 9 12共9个数。

2015-06-28 12:46:34 512

原创 51Nod 1103 N的倍数

一个长度为N的数组A,从A中选出若干个数,使得这些数的和是N的倍数。例如:N = 8,数组A包括:2 5 6 3 18 7 11 19,可以选2 6,因为2 + 6 = 8,是8的倍数。Input第1行:1个数N,N为数组的长度,同时也是要求的倍数。(2 <= N <= 50000)第2 - N + 1行:数组A的元素。(0 OutPut如果没有符

2015-06-26 22:35:27 699

原创 Codeforces 515C Drazil and Factorial

Drazil is playing a math game with Varda.Let's define  for positive integer x as a product of factorials of its digits. For example, .First, they choose a decimal number a consisting of n di

2015-06-26 20:19:27 617

转载 斐波那契博弈(Fibonacci Nim)

本文出自: http://blog.csdn.net/dgq8211/article/details/7602807有一堆个数为n(n>=2)的石子,游戏双方轮流取石子,规则如下:1)先手不能在第一次把所有的石子取完,至少取1颗;2)之后每次可以取的石子数至少为1,至多为对手刚取的石子数的2倍。约定取走最后一个石子的人为赢家,求必败态。结论:当n

2015-06-26 15:14:23 465

原创 HDU 4542 小明系列故事——未知剩余系

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4542参考了ACdreamer的博客:http://blog.csdn.net/ACdreamers/article/details/25049767首先对于本题(1)Type = 0即求解约数个数为K结果是一定存在,只不过存在超出范围和不超出范围两种情况,这个与反素数有关,

2015-06-26 11:07:32 702

原创 51Nod 1060 最复杂的数

把一个数的约数个数定义为该数的复杂程度,给出一个n,求1-n中复杂程度最高的那个数。例如:12的约数为:1 2 3 4 6 12,共6个数,所以12的复杂程度是6。如果有多个数复杂度相等,输出最小的。Input第1行:一个数T,表示后面用作输入测试的数的数量。(1 <= T <= 100)第2 - T + 1行:T个数,表示需要计算的n。(1 OutPut

2015-06-25 23:14:07 733

原创 Codeforces 27E Number With The Given Amount Of Divisors

Given the number n, find the smallest positive integer which has exactlyn divisors. It is guaranteed that for the givenn the answer will not exceed 1018.InputThe first line of the input

2015-06-25 22:23:53 451

原创 Codeforces 553C Love Triangles

There are many anime that are about "love triangles": Alice loves Bob, and Charlie loves Bob as well, but Alice hates Charlie. You are thinking about an anime which has n characters. The characters

2015-06-25 18:02:08 1520

原创 Codeforces 553B Kyoya and Permutation

Let's define the permutation of length n as an array p = [p1, p2, ..., pn] consisting of n distinct integers from range from 1 to n. We say that this permutation maps value 1 into the value p1,

2015-06-25 15:23:04 662

原创 Codeforces 553A Kyoya and Colored Balls

Kyoya Ootori has a bag with n colored balls that are colored with k different colors. The colors are labeled from 1 to k. Balls of the same color are indistinguishable. He draws balls from the bag

2015-06-25 10:13:43 529

原创 Codeforces 554B Ohana Cleans Up

Ohana Matsumae is trying to clean a room, which is divided up into an n by n grid of squares. Each square is initially either clean or dirty. Ohana can sweep her broom over columns of the grid. Her

2015-06-25 09:41:35 457

原创 Codeforces 554A Kyoya and Photobooks

Kyoya Ootori is selling photobooks of the Ouran High School Host Club. He has 26 photos, labeled "a" to "z", and he has compiled them into a photo booklet with some photos in some order (possibly with

2015-06-25 09:26:15 554

原创 Codeforces 552E Vanya and Brackets

Vanya is doing his maths homework. He has an expression of form , wherex1, x2, ..., xn are digits from1 to 9, and sign represents either a plus '+' or the multiplication sign '*'. Vanya needs t

2015-06-23 21:39:47 451

原创 Codeforces 552E Vanya and Brackets

Vanya is doing his maths homework. He has an expression of form , wherex1, x2, ..., xn are digits from1 to 9, and sign represents either a plus '+' or the multiplication sign '*'. Vanya needs t

2015-06-23 19:16:04 465

原创 Codeforces 552D Vanya and Triangles

Vanya got bored and he painted n distinct points on the plane. After that he connected all the points pairwise and saw that as a result many triangles were formed with vertices in the painted points.

2015-06-23 19:13:37 550

原创 Codeforces 552C Vanya and Scales

Vanya has a scales for weighing loads and weights of masses w0, w1, w2, ..., w100 grams wherew is some integer not less than 2 (exactly one weight of each nominal value). Vanya wonders whether h

2015-06-23 17:03:43 994

原创 ZOJ 3471 Most Powerful

Recently, researchers on Mars have discovered N powerful atoms. All of them are different. These atoms have some properties. When two of these atoms collide, one of them disappears and a lot of power

2015-06-23 12:00:13 520

原创 POJ 2288 Islands and Bridges

DescriptionGiven a map of islands and bridges that connect these islands, a Hamilton path, as we all know, is a path along the bridges such that it visits each island exactly once. On our map, the

2015-06-23 11:11:50 388

原创 HDU 3001 Travelling

Problem DescriptionAfter coding so many days,Mr Acmer wants to have a good rest.So travelling is the best choice!He has decided to visit n cities(he insists on seeing all the cities!And he does not

2015-06-23 09:54:31 465

原创 POJ 3311 Hie with the Pie

DescriptionThe Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast as possible. Unfortunately, due to cutbacks, they can afford to hire only one driver to do the deliveries

2015-06-23 09:16:31 425

原创 POJ 3254 Corn Fields

DescriptionFarmer John has purchased a lush new rectangular pasture composed of M byN (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of square

2015-06-22 12:07:32 475

原创 POJ 2441 Arrange the Bulls

DescriptionFarmer Johnson's Bulls love playing basketball very much. But none of them would like to play basketball with the other bulls because they believe that the others are all very weak. Farme

2015-06-22 10:31:54 458

原创 POJ 1185 炮兵阵地

Description司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能是平原(用"P"表示),如下图。在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署炮兵部队);一支炮兵部队在地图上的攻击范围如图中黑色区域所示:如果在地图中的灰色所标识的平原上部署一支炮兵部队,则图中的黑色的网格表

2015-06-21 15:02:44 1159

原创 SGU 223 Little Kings

After solving nice problems about bishops and rooks, Petya decided that he would like to learn to play chess. He started to learn the rules and found out that the most important piece in the game is t

2015-06-21 11:02:57 519

空空如也

空空如也

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

TA关注的人

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