自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

superxtong的博客

喝最烈的酒

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

原创 Gym 100917H之模拟+STL

题目传送门: http://vjudge.net/problem/Gym-100917H题意: 有一个office,office下有很多department(部门),现在要我们求office的头儿和部门的头儿是谁,规则如下: 在部门里,年老的为首领,如果年龄一样,则按照这个部门中id最小的那个为首领。 在office中也是如此,年老的为首领,如果年龄一样,则按照这个office中所有部门id

2016-10-02 00:57:45 408

原创 HDU5883之欧拉图

题目传送门: http://acm.hdu.edu.cn/showproblem.php?pid=5883官方题解: 判断一下是欧拉回路还是通路就好,如果不是的话就直接impossible代码:#include <cstdio>#include <cstring>#include <algorithm>#include <iostream>const int MAXN=100010;us

2016-09-17 21:34:53 318

原创 HDU4819之二维线段树

题目传送门:http://vjudge.net/contest/131028#problem/G题意: 给定一个n*n的矩阵,每次给定一个子矩阵区域(x,y,l),求出该区域内的最大值(A)和最小值(B),输出(A+B)/2,并用这个值更新矩阵[x,y]的值。树套树的做法,外层线段树的一个节点由内层线段树构成,内层线段树和普通线段树一样。见代码://http://vjudge.net/contes

2016-09-16 16:48:14 293

原创 URAL2014C之妙用线段树

题目传送门: http://acm.hust.edu.cn/vjudge/contest/128024#problem/C题意: 题目中的小明呢,会赚钱和花钱,花钱的时候会先花掉自己赚的钱,再去花老爸的信用卡,要注意小明不会存钱进去。现在小明每赚一次钱或者花一次钱,都会写一封信告诉老爸花了多少或者赚了多少,如果是用了老爸的信用卡,老爸就会记下来。但是收到信的顺序和实际小明花钱的顺序是不一样的,现在要

2016-08-13 23:44:57 345

原创 HDU5821之映射

题目传送门: http://acm.hdu.edu.cn/showproblem.php?pid=5821题意:给我们一个初始序列和目标序列,然后给m次操作,每次操作能修改从l到r的球的位置,问m次操作后能否得到最终序列。我们可以先将目标序列每个数的出现顺序和初始序列做一个映射,然后对于每次操作,在操作区间内排序,看最后得到的序列是否是1到n就可以了。代码:#include <cstdio>#in

2016-08-11 23:47:54 396

原创 HDU5818之优先队列

题目传送门: http://acm.hdu.edu.cn/showproblem.php?pid=5818题意:有两个栈,有3种操作。 第一种是往其中一个栈加入一个数; 第二种是取出其中一个栈的顶端数字; 第三种是将其中一个栈的所有元素放入另外一个栈,元素顺序依旧按照加入顺序来放。然后官方题解是这样的: 比较简单巧妙的一个做法是引入一个新的栈C,每次合并的时候就把A和B合并到C上,然后把A和B都清空

2016-08-09 20:39:51 344

原创 SPOJ-REPEATS之后缀数组

Description A string s is called an (k,l)-repeat if s is obtained by concatenating k>=1 times some seed string t with length l>=1. For example, the strings = abaabaabaabais a (4,3)-repeat with t = aba

2016-08-01 22:22:20 397

原创 POJ2406之后缀数组

E - Power StringsDescription Given two strings a and b we define a*b to be their concatenation. For example, if a = “abc” and b = “def” then a*b = “abcdef”. If we think of concatenation as multiplicat

2016-08-01 01:42:45 2764 5

原创 POJ3261之后缀数组

Milk Patterns Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 13891 Accepted: 6143 Case Time Limit: 2000MS DescriptionFarmer John has noticed that the quality of milk given b

2016-08-01 00:23:04 344

原创 HDU5778之暴力枚举

absTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 391 Accepted Submission(s): 137Problem Description Given a number x, ask positive inte

2016-07-31 01:37:33 1104

原创 POJ1743之后缀数组

Musical Theme Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 25579 Accepted: 8630 DescriptionA musical melody is represented as a sequence of N (1<=N<=20000)notes that are in

2016-07-29 01:37:44 273

原创 HDU5769之后缀数组

SubstringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 177 Accepted Submission(s): 63Problem Description ?? is practicing his program ski

2016-07-29 00:06:19 1158

原创 POJ1740之构造博弈

题目传送门: http://poj.org/problem?id=1740从简单开始,首先,一堆的话先手必胜。如果有两堆,则只有两堆相同的时候先手会输。若两堆不同,先手可以造成两堆相同的局面从而不输。如果有三堆,先手可以拿走一堆并制造两堆相同的情况。我们发现,将n堆石子排序,如果石子数量对称,即每种数量的石子有偶数堆,则先手必输。 因为先手并不能取光所有的,而后手只要模仿先手的行为就能一直有石子

2016-07-28 01:21:07 313

原创 HDU2147之打表找规则

题目传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2147P点:就是P个石子的时候,对方拿可以赢(自己输的)N点:就是N个石子的时候,自己拿可以赢现在关于P,N的求解有三个规则(1):最终态都是P(2):按照游戏规则,到达当前态的前态都是N的话,当前态是P(3):按照游戏规则,到达当前态的前态至少有一个P的话,当前态是N题意:在一个m*n的棋盘内,从

2016-07-28 00:35:49 301

原创 HDU1846之巴什博弈

题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1846简单题~#include <cstdio>#include <iostream>#include <algorithm>using namespace std;int main (void){ int t; int flag; cin>>t; while

2016-07-28 00:28:20 222

原创 HDU1847之SG值

题目传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1847模板题、#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <cmath>const int MAXN=1005;using namespace std;int sg

2016-07-28 00:26:01 388

原创 POJ1704之Nim博弈

题目传送门:http://poj.org/problem?id=1704模板题~#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <cmath>const int MAXN=1005;int a[MAXN];int num;using namespace std;vo

2016-07-28 00:22:56 253

原创 POJ1067之威佐夫博弈

题目传送门:http://poj.org/problem?id=1067主要求出当前是不是奇异局势就好啦~要用到黄金分割~代码:#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <cmath>const int MAXN=10000;using namespace std;

2016-07-28 00:20:43 249

原创 POJ2505之找规律

题目传送门:http://poj.org/problem?id=2505看看代码就懂啦~。记得要向上取整~#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>const int MAXN=10000;using namespace std;int main (void){ long

2016-07-28 00:18:16 482

原创 POJ2975&HDU2176

题目传送门: http://poj.org/problem?id=2975 http://acm.hdu.edu.cn/showproblem.php?pid=2176因为两题都差不多,所以我就放在一起写啦。n堆石子,然后问如果必胜的话有多少种移动方法(一步)。 因为答案最多只有n,令ans=a1^a2^…^an。 如果需要构造出异或值为0的数,而且由于只能操作一堆石子,所以对于某堆石子ai

2016-07-27 23:56:55 306

原创 Codeforces Round #364 (Div. 2)C

C. They Are EverywhereSergei B., the young coach of Pokemons, has found the big house which consists of n flats ordered in a row from left to right. It is possible to enter each flat from the street. I

2016-07-27 01:30:30 228

原创 hdu1536-SG值

S-NimTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6549 Accepted Submission(s): 2772Problem Description Arthur and his sister Caroll have

2016-07-27 00:33:43 380

原创 HDU_1907&2509 博弈(Nim博弈变形)

JohnTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 4184 Accepted Submission(s): 2386Problem Description Little John is playing very funny

2016-07-27 00:25:43 212

原创 HDU5515-Game of Flying Circus

这里的题解写的非常好。 http://blog.csdn.net/snowy_smile/article/details/49535301代码:#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <cmath>using namespace std;double t1;d

2016-07-26 01:14:47 323

转载 模拟退火算法

一. 爬山算法 ( Hill Climbing ) 介绍模拟退火前,先介绍爬山算法。爬山算法是一种简单的贪心搜索算法,该算法每次从当前解的临近解空间中选择一个最优解作为当前解,直到达到一个局部最优解。 爬山算法实现很简单,其主要缺点是会陷入局部最优解,而不一定能搜索到全局最优解。如图1所示:假设C点为当前解,爬山算法搜索到A点这个局部最优解就会停止搜索,因为在A点无论向那个方向小幅度

2016-07-24 21:50:54 1236

原创 UVALive 7261 A - Xiongnu's Land

Wei Qing (died 106 BC) was a military general of the Western Han dynasty whose campaigns against the Xiongnu earned him great acclaim. He was a relative of Emperor Wu because he was the younger half-

2016-07-24 16:56:46 1323

原创 Bellovin

链接:http://acm.hdu.edu.cn/showproblem.php?pid=5748题意:对每一位的最长上升子序列,求出另一个序列。例如:12435。对第一位:1 对第二位:12 对第三位:124 对第四位:124 对第五位:1245所以结果就是:12334。所以对每一位都求一下最长上升子序列就好啦。#include <cstdio>#include <algorithm>

2016-07-24 02:16:18 351

原创 Aaronson

Problem Description Recently, Peter saw the equation x0+2x1+4x2+…+2mxm=n. He wants to find a solution (x0,x1,x2,…,xm) in such a manner that ∑i=0mxi is minimum and every xi (0≤i≤m) is non-negative.Inpu

2016-07-24 02:06:10 478

原创 C - Push!!

Mr. Schwarz was a famous powerful pro wrestler. He starts a part time job as a warehouseman. His task is to move a cargo to a goal by repeatedly pushing the cargo in the warehouse, of course, without b

2016-07-23 01:28:55 394

原创 E - Lazy Math Instructor

Description A math instructor is too lazy to grade a question in the exam papers in which students are supposed to produce a complicated formula for the question asked. Students may write correct answ

2016-07-23 01:21:51 366

原创 F - Buggy Sat

Discovery Co. ltd. builds a satellite using a new kind of an intelligent camera. The camera has special software to detect cities and roads from an image, and is also able to detect every region (which

2016-07-23 01:18:44 291

原创 C. NP-Hard Problem

Recently, Pari and Arya did some research about NP-Hard problems and they found the minimum vertex cover problem very interesting.Suppose the graph G is given. Subset A of its vertices is called a vert

2016-07-23 01:11:14 507

原创 B - FatMouse's Speed

Input Input contains data for a bunch of mice, one mouse per line, terminated by end of file. The data for a particular mouse will consist of a pair of integers: the first representing its size in gra

2016-07-13 23:59:09 314

原创 A - 最少拦截系统

Description 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹. 怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计算

2016-07-13 23:42:07 643

原创 F - Longest Ordered Subsequence

Description A numeric sequence of ai is ordered if a1 < a2 < … < aN. Let the subsequence of the given numeric sequence ( a1, a2, …, aN) be any sequence ( ai1, ai2, …, aiK), where 1 <= i1 < i2 < … < iK

2016-07-13 23:39:01 176

原创 H - Wormholes

Description While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a

2016-07-13 00:10:42 422

原创 E - Frogger

Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of t

2016-07-13 00:06:46 361

原创 D - Subway

Description You have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get to walk and take the subway. Because you

2016-07-13 00:00:53 464

原创 C - Arctic Network

Description 国防部(DND)要用无线网络连接北部几个哨所。两种不同的通信技术被用于建立网络:每一个哨所有一个无线电收发器,一些哨所将有一个卫星频道。 任何两个有卫星信道的哨所可以通过卫星进行通信,而不管他们的位置。同时,当两个哨所之间的距离不超过D时可以通过无线电通讯,D取决于对收发器的功率。功率越大,D也越大,但成本更高。出于采购和维修的方便,所有哨所的收发器必须是相同的;那就是说

2016-07-12 19:51:17 359

原创 POJ3253-Fence Repair

DescriptionFarmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some integer length L

2016-07-11 23:33:50 220

空空如也

空空如也

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

TA关注的人

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