自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

阳光下的泡沫

我用双手成就我的梦想

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

原创 2015 多校联赛 ——HDU5416(异或)

CRB has a tree, whose vertices are labeled by 1, 2, …, N. They are connected by N – 1 edges. Each edge has a weight.For any two vertices u and v(possibly equal), f(u,v) is xor(exclusive-or)

2015-08-31 03:26:22 637

原创 2015 多校联赛 ——HDU5414()

Problem DescriptionCRB has two strings s and t.In each step, CRB can select arbitrary character c of s and insert any character d (d ≠ c) just after it.CRB wants to convert s to t. But i

2015-08-31 03:15:27 495

原创 2015 多校联赛 ——HDU5410(dp)

Sample Input1100 210 2 120 1 1 Sample Output21题意:共有m元钱和n种东西,求每种单价p,而且你买x个该种物品可以得到Ax+B个,求m元钱最多能得到多少。思路:先01背包处理出A+B的情况,再用完全背包往里算加A能得到的情况。#include#include#include

2015-08-26 20:32:32 520

原创 2015 多校联赛 ——HDU5402(模拟)

For each test case, in the first line, you should print the maximum sum.In the next line you should print a string consisting of "L","R","U" and "D", which represents the path you find. If you are

2015-08-19 10:15:19 526

原创 2015 多校联赛 ——HDU5400(水)

Sample Input5 2 -20 2 0 -2 05 2 32 3 3 3 3 Sample Output125求最多多少序列满足,前半部分满足d(j+1) = d(j)+d1,后半部分d(j+1)= d(j)+d2,或者只满足其中一个。假设可以找出长度为x的序列,则有x-1 + x-2 + .... + 1种。所以从头到尾

2015-08-19 09:31:12 413

原创 hdu 5340 (manacher)

Sample Input2abcabaadada Sample OutputYesNo判断是否能成为3个非空回文子串manacher算法,在找出第一个和最后一个保存下来,再判断中间的#include#include#include#include#includeusing namespace std;type

2015-08-17 15:34:45 451

原创 hdu 5392

Sample Input231 3 262 3 4 5 6 1 Sample Output26题意:给一个转置求它的循环长度题解:分解成循环求最小公倍数#include#include#include#include#includeusing namespace std;typedef long lo

2015-08-16 16:03:55 875

原创 hdu 5391 (数论)

Sample Input2310 Sample Output20题意:求 (n-1)%n,合数为0,因为1 ~ n-1中必定有积为n(除了4)质数为n-1,威尔逊定理( p -1 )! ≡ -1 ( mod p )#include#include#include#include#includeusi

2015-08-16 11:19:56 632

原创 poj 2528 (线段树+离散化)

poj 2528For each input data set print the number of visible posters after all the posters are placed. The picture below illustrates the case of the sample input. Sample Input151 4

2015-08-15 21:20:11 454

原创 poj 3264 & poj 3468(线段树)

poj 3264Sample Input6 31734251 54 62 2Sample Output630求任一区间的最大值和最小值的差#include#include#include#include#includeusing namespace std;#define N 50005#define mod 258280327

2015-08-15 20:47:37 417

原创 2015 多校联赛 ——HDU5372(树状数组)

Sample Input30 00 30 150 10 01 10 10 0 Sample OutputCase #1:000Case #2:0102有0,1两个操作,0  x代表添加从x 到 x + i(带表第i次添加)的线段,每次添加时问被其覆盖的线段有多少。                     

2015-08-14 16:55:50 485

原创 2015 多校联赛 ——HDU5389(dp)

Sample Input43 9 11 2 63 9 12 3 35 2 31 1 1 1 19 9 91 2 3 4 5 6 7 8 9 Sample Output101060题意:已知有两个门,要求将人分为两组,两组的“和”分别等于两个门的数字,当然也可以全部进入一个门思路:(NeverMoreH)如果能

2015-08-14 11:28:28 521

原创 poj3270 && poj 1026(置换问题)

在一个置换下,x1->x2,x2->x3,...,xn->x1,这样(x1,x2,...,xn)就构成了一个循环每一个置换都可以唯一的分解为若干个不交的循环如上面那个  可以 =>(1,3,5,4)  1的下面是3  ;3的下面是5 一直循环。   (2,6)poj 3270思路:(参考北大的群论以及ACM_cxiove)一个循环,有两种处理方法:①用这

2015-08-14 11:07:24 535

原创 2015 多校联赛 ——HDU5386(暴力)

Sample Input13 52 2 1 2 3 3 2 1 3 3 3 3 3 3 3 3 3 3 H 2 3L 2 2H 3 3H 1 3L 2 3 Sample Output5 2 4 3 1给你一个初始矩阵和目标矩阵,包含‘L’ , ' H' 两个操作, ‘L x y’  表示把第x列全赋值成y, ‘

2015-08-13 22:02:02 462

原创 2015 多校联赛 ——HDU5384(AC自动机)

Sample Input15 6orzstokirigiridanganronpaooooookyoukodanganronpaoooooooooo Sample Output11037 题意:给n个母串,给m个匹配串,求每个母串依次和匹配串匹配,能得到的数目和开始用KMP超时了,突然看见AC,

2015-08-13 20:35:01 585

原创 2015 多校联赛 ——HDU5371(manacher + 枚举)

Sample Input1102 3 4 4 3 2 2 3 4 4 Sample Output要求找出一段数字。Case #1: 9将其分成3部分,第①和第②部分成回文字串,第②和第③部分成回文字串用manacher算出各个点的回文字串,然后枚举点和半径(后部分稍不注意就超时  - -!!)#include #include

2015-08-12 11:58:13 546

原创 2015 多校联赛 ——HDU5375(dp)

Sample Input200?01 2 4 8????1 2 4 8 Sample OutputCase #1: 12Case #2: 15?部分可以是0  or  1,将二进制转化成格雷码后,哪里是 1 就可以取相应的数,求得到数的最大值①:判断连续的?的个数奇偶不同,两边是否相等。在有时会去掉一个最小值。(感觉写着

2015-08-12 10:38:20 423

原创 2015 多校联赛 ——HDU5373(模拟)

Problem DescriptionIn this problem, we should solve an interesting game. At first, we have an integer n, then we begin to make some funny change. We sum up every digit of the n, then insert it to

2015-08-12 10:10:59 520

原创 hdu4542 && ZOJ2562(反素数)

反素数:对于任何正整数,其约数个数记为,例如,如果某个正整数满足:对任意的正整数,都有,那么称为反素数。有两个特点:1.一个反素数的质因子必是从2开始的质数2.如果,那么必有(http://blog.csdn.net/ACdreamers/article/details/25049767)ZOJ2562题意:给定一个数N,

2015-08-10 15:23:13 664

原创 poj 1811 随机素数和大数分解(模板)

Sample Input2510Sample OutputPrime2模板学习:判断是否是素数,数据很大,所以用miller,不是的话再用pollard rho分解miller : 通过费马小定理,若N为素数,a^(N-1) = 1 (mod N),再利用二次判定:若x为素数,0#include #include #include #i

2015-08-09 19:56:37 461

原创 poj 2689 (素数二次筛选)

Sample Input2 1714 17Sample Output2,3 are closest, 7,11 are most distant.There are no adjacent primes.找出给定范围内,距离最远和最近的素数。(不停超时 - -)给的上界很大,所以全处理肯定不行。 先处理sqrt(2147483647)。然后再在l 与 r之间筛

2015-08-09 15:29:38 404

原创 hdu4549(费马小定理 + 快速幂)

M斐波那契数列F[n]是一种整数数列,它的定义如下:F[0] = aF[1] = bF[n] = F[n-1] * F[n-2] ( n > 1 )现在给出a, b, n,你能求出F[n]的值吗? Input输入包含多组测试数据;每组数据占一行,包含3个整数a, b, n( 0  Output对每组测试数据请输出一

2015-08-09 11:39:20 1409

转载 数学(转)

转——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————从放暑假前周sir给我讲了一个用pol

2015-08-09 10:56:03 1001

转载 【转】一些图论、网络流入门题总结、汇总

最短路问题此类问题类型不多,变形较少 POJ 2449 Remmarguts' Date(中等)http://acm.pku.edu.cn/JudgeOnline/problem?id=2449题意:经典问题:K短路解法:dijkstra+A*(rec),方法很多相关:http://acm.pku.edu.cn/JudgeOnline/showcontest?c

2015-08-09 10:48:33 529

原创 hdu2669与hdu1576(扩展欧几里德)

模板:int Extend_Euclid(int a, int b, int &x, int &y){        if(b == 0){            x = 1;             y = 0;            return a;        }        else{            int gcd,t;    

2015-08-08 15:04:29 483

原创 HDU2108和HDU2036(叉乘)

hdu2108判断是否为凸边形判断连续三点的叉乘若为凸,内角180所以通过正负来判断#include #include #include #include #include #include #include typedef long long ll;typedef unsigned long long ull;using namespace std;

2015-08-08 10:18:03 705

原创 HDU2303(数论)大整数求余+素数筛选

Sample Input143 10143 20667 20667 302573 302573 400 0 Sample OutputGOODBAD 11GOODBAD 23GOODBAD 31 给你两个数a ,b; 让你求a 的最小素因子是否小于b枚举小于b 的素数对a进行大整数求余即可。按照这

2015-08-07 20:12:47 574

原创 2015 多校联赛 ——HDU5360(贪心+优先队列)

Sample Input484 1 3 2 2 1 0 35 3 6 4 2 1 7 683 3 2 0 5 0 3 64 5 2 7 7 6 7 682 2 3 3 3 0 0 27 4 3 6 3 2 2 585 6 5 3 3 1 2 46 7 7 6 5 4 3 5 Sample Output71 7 6 5 2 4 3 8

2015-08-07 10:56:07 501

原创 2015 多校联赛 ——HDU5363(快速幂)

Problem Descriptionsoda has a set S with n integers {1,2,…,n}. A set is called key set if the sum of integers in the set is an even number. He wants to know how many nonempty subsets of S are

2015-08-06 20:09:15 469

原创 2015 多校联赛 ——HDU5353(构造)

Each soda has some candies in their hand. And they want to make the number of candies the same by doing some taking and giving operations. More specifically, every two adjacent soda x and y can do

2015-08-06 19:42:44 488

原创 2015 多校联赛 ——HDU5348(搜索)

Problem DescriptionAs we all kown, MZL hates the endless loop deeply, and he commands you to solve this problem to end the loop.You are given an undirected graph with n vertexs and m edges.

2015-08-05 11:14:55 630

原创 2015 多校联赛 ——HDU5350(huffman)

Problem DescriptionMZL is a mysterious mathematician, and he proposed a mysterious function at his young age.Stilwell is very confused about this function, and he need your help.First of all,

2015-08-04 22:33:00 1290

原创 2015 多校联赛 ——HDU5349(水)

Problem DescriptionA simple problemProblem DescriptionYou have a multiple set,and now there are three kinds of operations:1 x : add number x to set2 : delete the minimum number (if the set

2015-08-04 20:04:10 482

原创 2015 多校联赛 ——HDU5344(水)

Problem DescriptionMZL loves xor very much.Now he gets an array A.The length of A is n.He wants to know the xor of all (Ai+Aj)(1≤i,j≤n)The xor of an array B is defined as B1 xor B2...xor Bn

2015-08-04 20:00:38 437

原创 HDU5339——Untitled

Problem DescriptionThere is an integer a and n integers b1,…,bn. After selecting some numbers from b1,…,bn in any order, say c1,…,cr, we want to make sure that a mod c1 mod c2 mod… mod cr=0 

2015-08-04 16:13:40 478

原创 UVA129 —— Krypton Factor (氪因素)

Input and OutputIn order to provide the Quiz Master with a potentially unlimited source of questions you are asked to write a program that will read input lines that contain integers n and L (in

2015-08-02 21:23:26 526

原创 UVA140 ——bandwidth(搜索)

Given a graph (V,E) where V is a set of nodes and E is a set of arcs in VxV, and an ordering on the elements in V, then the bandwidth of a node v is defined as the maximum distance in the ordering bet

2015-08-02 21:12:09 425

原创 hihocoder——1041国庆出游(搜索)

描述小Hi和小Ho准备国庆期间去A国旅游。A国的城际交通比较有特色:它共有n座城市(编号1-n);城市之间恰好有n-1条公路相连,形成一个树形公路网。小Hi计划从A国首都(1号城市)出发,自驾遍历所有城市,并且经过每一条公路恰好两次——来回各一次——这样公路两旁的景色都不会错过。令小Hi苦恼的是他的小伙伴小Ho希望能以某种特定的顺序游历其中m个城市。例如按3-2-5的顺

2015-08-02 21:04:26 890

原创 2015 多校联赛 ——HDU5334(构造)

Virtual ParticipationTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 237    Accepted Submission(s): 56Special JudgeProblem Descripti

2015-08-01 18:38:14 828

空空如也

空空如也

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

TA关注的人

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