Throw nails Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1729    Accepted Submission(s): 538 Problem Description The annual school bicycle contest started. ZL is a student in this school. He…
题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=115361#problem/D 题意大致是:给出最多50000个人,拥有最初速度F和1秒后的速度V,(F<=500,V<=100)每秒将速度最快的那个人淘汰,按淘汰的人的顺序输出他们的序号. 思路:由于人数很多,用暴力更新每秒淘汰的人显然会TLE.注意到F很小,那么对于任意两个人来说,即使有500的路程差,速度快的那个人哪怕是每秒只快1米,在501秒后就能超越,也就是说,50…
Problem Description The annual school bicycle contest started. ZL is a student in this school. He is so boring because he can't ride a bike!! So he decided to interfere with the contest. He has got the players' information by previous contest video.…
优先队列的应用 好坑,好坑,好坑,重要的事情说三遍! #include<iostream> #include<cstdio> #include<cstring> #include<queue> using namespace std; #define maxn 50005 struct Node { int f,s,id; friend bool operator < (Node a,Node b) { if(a.f != b.f) return a.…
水题,优先级队列. /* 4393 */ #include <iostream> #include <sstream> #include <string> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #include <deque> #include <algorithm&g…
                                                                                                              Throw nails The annual school bicycle contest started. ZL is a student in this school. He is so boring because he can't ride a bike!! So he…
HDU 4442 Physical Examination(贪心) 题目链接http://acm.split.hdu.edu.cn/showproblem.php?pid=4442 Description WANGPENG is a freshman. He is requested to have a physical examination when entering the university. Now WANGPENG arrives at the hospital. Er-.. Th…
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1598 一道带有贪心思想的并查集 所以说像二分,贪心这类基础的要掌握的很扎实才行. 用结构体数组储存公路编号和速度,然后按照速度从小到大的排序, 然后以每条路为起点枚举(已经排了序,所以可以保证可以取最小的),再利用并查集判断是否走到 最后比较出最小的差值 code #include<cstdio> #include<algorithm> using namespace std; ;…
题意:输入一棵树,输出前k小的点对最短距离dis(i,j)的和. 模拟,官方题解说得很清楚了.不重复了. http://bestcoder.hdu.edu.cn/ 需要注意的是,复杂度要O(n+k),不能用set,map之类的标记是否访问. 一开始TLE了,去掉标记后wa了.最后发现对队列的元素加个前缀,就可以了,即标记该条边是从哪个点延伸的. #include <cstdio> #include <cstring> #include <iostream> #inclu…
Danganronpa 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5835 Description Chisa Yukizome works as a teacher in the school. She prepares many gifts, which consist of n kinds with a[i] quantities of each kind, for her students and wants to hold a cl…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4550 题意:有n(n <= 100)个0~9之间的卡片,从左往右将卡片放到之前的卡片最左边或者最右边:使得最后得到的数值最小,且无前导0: input: output: 思路:如果没有0,则直接用双指针,模拟前后插入值即可:但是由于存在0,所以需要找出最小的非零0,使得最前面以mn开头,之后是可填入的若干个0.所谓可填入的即指在最后一个mn填入之前的0,这就需要记录mn的个数,每次插入mn时,--c…
Basic Data Structure Time Limit: 7000/3500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 872    Accepted Submission(s): 236 Problem Description Mr. Frog learned a basic data structure recently, which is called stac…
题目链接:http://acm.swust.edu.cn/problem/352/ Time limit(ms): 1000 Memory limit(kb): 65535   Description 在一个果园里,多多已经将所有的果子打了下来,而且按果子的不同种类分成了不同的堆.多多决定把所有的果子合成一堆. 每一次合并,多多可以把两堆果子合并到一起,消耗的体力等于两堆果子的重量之和.可以看出,所有的果子经过n-1次合并之后,就只剩下一堆了.多多在合并果子时总共消耗的体力等于每次合并所耗体力之…
Trouble Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5388    Accepted Submission(s): 1494 Problem Description Hassan is in trouble. His mathematics teacher has given him a very difficult pro…
Detachment Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 570    Accepted Submission(s): 192 Problem Description In a highly developed alien society, the habitats are almost infinite dimensiona…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4930 解题报告:斗地主,加了一个四张可以带两张不一样的牌,也可以带一对,判断打出一手牌之后,如果对手没有能够大过你的牌就输出Yes,或者如果你把手上的牌一次性打完也输出Yes,否则输出No,代码有280多行,表示光是敲代码就花了一个多小时,手速还是太慢. 1.首先判断手上的牌能不能一次打完 如果一次性打不完: 2.首先判断对方有没有一对王,有就输出No 3.判断对手有没有四张的牌,如果有,再判断自己…
题意 现在有一个怪兽序列a[i],权值大的怪兽可以吃权值小的怪兽,吃完之后权值大的怪兽的权值会变成两者权值的和,相邻的怪兽才能吃 吃完之后,位置合并,队列前移,从左到右重新编号,重复这一过程, 然后给你一个怪兽序列b[i],问你a[i]怎么操作能变成b[i],如果能操作,输出操作序列,如果不能操作就输出NO 难点一,划分序列,由于b[i]的概念类似于前缀和,一旦b[i]是确定的数,那么a[i]序列的划分就是唯一的,b[i]和a[i]的和相等 b[i]序列实际上就是对序列a[i]的唯一划分 难点二…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4573 Problem Description Remember our childhood? A few naked children throw stones standing on the same position, the one throws farther win the game. Aha, of course, there are some naughty boys who care…
NanoApe Loves Sequence 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5805 Description NanoApe, the Retired Dog, has returned back to prepare for the National Higher Education Entrance Examination! In math class, NanoApe picked up sequences once aga…
Ball 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5821 Description ZZX has a sequence of boxes numbered 1,2,...,n. Each box can contain at most one ball. You are given the initial configuration of the balls. For 1≤i≤n, if the i-th box is empty the…
Bazinga Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5510 Description Ladies and gentlemen, please sit up straight. Don't tilt your head. I'm serious.For n given strings S1,S2,⋯,Sn, labelled from 1 to n, you…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4708 题目大意:给定一个方形矩阵,边长为3-10的奇数.每一圈的数字可以沿着顺时针方向和逆时针方向旋转,求使得矩阵主对角线和反对角线和最大时的数以及需要旋转的最小步骤. Sample Input 5 9 3 2 5 9 7 4 7 5 4 6 9 3 9 3 5 2 8 7 2 9 9 4 1 9 0   Sample Output 72 1 分析:简单的模拟.分别计算每一圈旋转后的四个角的值最大需…
异或密码 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description 晨晨在纸上写了一个长度为N的非负整数序列{ai}.对于这个序列的一个连续子序列{al,al+1,-,ar}晨晨可以求出其中所有数异或的结果 alxoral+1xor...xorar其 中xor表示位异或运算,对应C.C++. Java等语言中的^运算.小璐提出了M个询问,每个询问用…
Relative atomic mass Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 66    Accepted Submission(s): 59 Problem Description Relative atomic mass is a dimensionless physical quantity, the ratio of…
Minimum's Revenge Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 283    Accepted Submission(s): 219 Problem Description There is a graph of n vertices which are indexed from 1 to n. For any pai…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4814 题意:黄金比例切割点是,如今要求把一个10进制的的数转化成一个phi进制的数,而且不能出现'11'的情况. 思路:因为题目中给出了两个式子,题目就变成了一道简单的模拟题了.因为整个phi进制的数最多仅仅有200,而数据中最多仅仅有100位,所以从aa[50]=tot 開始模拟就可以. 代码: #include<iostream> #include<cstdio> #include&l…
主题链接:HDU 2414 Chessboard Dance 意甲冠军:鉴于地图,>,<,^,v的方向,字母相当于是箱子,箱子能够推出边界.人保证不会做出边界.以下输入指令,依照指令走,输出结束时图的状态. 强行模拟一遍,注意以下给出的案例. >t.p.p.p ...a.... ........ ...bfg.y ...c... ...d.... ...e.... ........ move 3 turn right move 3 turn left move 3 turn left m…
Dying Light Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 513    Accepted Submission(s): 122 Problem Description LsF is visiting a local amusement park with his friends, and a mirror room su…
Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4638    Accepted Submission(s): 2111 Problem Description 话说上回讲到海东集团面临内外交困,公司的元老也只剩下XHD夫妇二人了.显然,作为多年拼搏的商人,XHD不会坐以待毙的.   一天,当他正在苦思冥想解困良策…
zxa and xor 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5683 Description zxa had a great interest in exclusive disjunction(i.e. XOR) recently, therefore he took out a non-negative integer sequence a1,a2,⋯,an of length n. zxa thought only doing th…