05 2017 档案

Editing a Book UVA - 11212 IDA*
摘要:You have n equal-length paragraphs numbered 1 to n . Now you want to arrange them in the order of 1 ; 2 ;:::;n . With the help of a clipboard, you can 阅读全文

posted @ 2017-05-24 16:27 hnust_accqx 阅读(263) 评论(0) 推荐(0)

埃及分数问题 迭代加深搜索
摘要:/** 题目:埃及分数问题 链接:lrj算法竞赛入门经典P206 题意:在古埃及,人们使用单位分数的和(即 1/a, a是自然数)表示一切有理数。例如,2/3 = 1/2+1/6; 但不允许:2/3 = 1/3 + 1/3; 因为在加数中不允许有相同的。 对一个分数a/b, 表示方法有很多种,其中加数少的比加数多的好,如果加数个数相同,则最小的分数越大越好。 eg: 19/45=1/3 + 1/... 阅读全文

posted @ 2017-05-24 14:10 hnust_accqx 阅读(424) 评论(0) 推荐(0)

STL next_permutation(a,a+n) 生成一个序列的全排列。满足可重集。
摘要:/** 题目: 链接: 题意: 思路: */ #include #include #include #include #include #include using namespace std; typedef long long LL; const int mod=1e9+7; const int maxn=1e2+5; const double eps = 1e-12; in... 阅读全文

posted @ 2017-05-24 12:36 hnust_accqx 阅读(462) 评论(0) 推荐(0)

Play on Words UVA - 10129 欧拉路径
摘要:关于欧拉回路和欧拉路径 定义:欧拉回路:每条边恰好只走一次,并能回到出发点的路径欧拉路径:经过每一条边一次,但是不要求回到起始点 ①首先看欧拉回路存在性的判定: 一、无向图每个顶点的度数都是偶数,则存在欧拉回路。 二、有向图(所有边都是单向的)每个节顶点的入度都等于出度,则存在欧拉回路。 ②.欧拉路 阅读全文

posted @ 2017-05-24 11:16 hnust_accqx 阅读(174) 评论(0) 推荐(0)

Ordering Tasks UVA - 10305 图的拓扑排序
摘要:John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task is only possible if other tasks have already been e 阅读全文

posted @ 2017-05-24 10:21 hnust_accqx 阅读(190) 评论(0) 推荐(0)

hdu5800 To My Girlfriend dp 需要比较扎实的dp基础。
摘要:To My Girlfriend Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1288 Accepted Submission(s): 492 阅读全文

posted @ 2017-05-23 17:40 hnust_accqx 阅读(182) 评论(0) 推荐(0)

hdu5802 Windows 10 贪心
摘要:Windows 10 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2096 Accepted Submission(s): 630 Probl 阅读全文

posted @ 2017-05-22 13:25 hnust_accqx 阅读(150) 评论(0) 推荐(0)

2017计蒜之道 初赛 第二场 百度的科学计算器(简单)
摘要:/** 题目:2017计蒜之道 初赛 第二场 百度的科学计算器(简单) 链接:https://nanti.jisuanke.com/t/15504 题意:给一个合法的表达式,包含加号+、减号-、括号()、数字常量,表达式中没有空格。 输入数据保证数字常量以及计算过程中数值绝对值均不超过 10^12​​,对于浮点型数值常量,保证小数点后不超过 6位。 思路:暴力模拟;python有函数可以直... 阅读全文

posted @ 2017-05-22 11:03 hnust_accqx 阅读(230) 评论(0) 推荐(0)

EOJ Problem #3249 状态压缩+循环周期+反向递推
摘要:限量供应 Time limit per test: 4.0 seconds Time limit all tests: 4.0 seconds Memory limit: 256 megabytes 限量供应 Time limit per test: 4.0 seconds Time limit a 阅读全文

posted @ 2017-05-22 10:49 hnust_accqx 阅读(257) 评论(0) 推荐(0)

hdu2068 RPG的错排 错排+组合
摘要:RPG的错排 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 13155 Accepted Submission(s): 5378 Problem 阅读全文

posted @ 2017-05-21 14:57 hnust_accqx 阅读(151) 评论(0) 推荐(0)

hdu1018 Big Number 斯特林公式 求N!的位数。
摘要:Big Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 37732 Accepted Submission(s): 18174 Pr 阅读全文

posted @ 2017-05-21 14:54 hnust_accqx 阅读(191) 评论(0) 推荐(0)

hdu2049 不容易系列之(4)——考新郎 错排+组合 一共有N对新婚夫妇,N个新娘随机坐成一排,每个新郎只能选一个, 其中有M个新郎找错了新娘,求发生这种情况一共有多少种可能.
摘要:不容易系列之(4)——考新郎 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 37629 Accepted Submission(s): 1378 阅读全文

posted @ 2017-05-21 14:25 hnust_accqx 阅读(927) 评论(0) 推荐(0)

hdu5673 Robot 卡特兰数+组合数学+线性筛逆元
摘要:Robot Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 483 Accepted Submission(s): 244 Problem De 阅读全文

posted @ 2017-05-21 14:04 hnust_accqx 阅读(329) 评论(0) 推荐(0)

hdu5794 A Simple Chess 容斥+Lucas 从(1,1)开始出发,每一步从(x1,y1)到达(x2,y2)满足(x2−x1)^2+(y2−y1)^2=5, x2>x1,y2>y1; 其实就是走日字。而且是往(n,m)方向走的日字。还有r个障碍物,障碍物不可以到达。求(1,1)到(n,m)的路径条数。
摘要:A Simple Chess Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2597 Accepted Submission(s): 691 P 阅读全文

posted @ 2017-05-21 12:35 hnust_accqx 阅读(1344) 评论(0) 推荐(0)

hdu5795 A Simple Nim 求nim求法,打表找sg值规律 给定n堆石子,每堆有若干石子,两个人轮流操作,每次操作可以选择任意一堆取走任意个石子(不可以为空) 或者选择一堆,把它分成三堆,每堆不为空。求先手必胜,还是后手必胜。
摘要:/** 题目:A Simple Nim 链接:http://acm.hdu.edu.cn/showproblem.php?pid=5795 题意:给定n堆石子,每堆有若干石子,两个人轮流操作,每次操作可以选择任意一堆取走任意个石子(不可以为空) 或者选择一堆,把它分成三堆,每堆不为空。求先手必胜,还是后手必胜。 思路: 组合游戏Nim; 计算出每一堆的sg值,然后取异或。异或和>0那么先手... 阅读全文

posted @ 2017-05-21 10:13 hnust_accqx 阅读(2350) 评论(0) 推荐(0)

Tree UVA - 548 已知中序遍历和后序遍历,求这颗二叉树。
摘要:You are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the binary 阅读全文

posted @ 2017-05-20 18:22 hnust_accqx 阅读(325) 评论(0) 推荐(0)

Trees on the level UVA - 122 复习二叉树建立过程,bfs,queue,strchr,sscanf的使用。
摘要:Trees are fundamental in many branches of computer science (Pun definitely intended). Current state- of-the art parallel computers such as Thinking Machines’ CM-5 are based on fat trees . Quad- and o... 阅读全文

posted @ 2017-05-17 13:50 hnust_accqx 阅读(233) 评论(0) 推荐(0)

UVA 679 Dropping Balls 由小见大,分析思考 二叉树放小球,开关翻转,小球最终落下叶子编号。
摘要:A number of K balls are dropped one by one from the root of a fully binary tree structure FBT. Each time the ball being dropped first visits a non-terminal node. It then keeps moving down, either fol... 阅读全文

posted @ 2017-05-17 13:01 hnust_accqx 阅读(415) 评论(0) 推荐(0)

2017-5-14 湘潭市赛 Similar Subsequence 分析+四维dp+一些简单优化
摘要:Similar Subsequence Accepted : 10 Submit : 53 Time Limit : 10000 MS Memory Limit : 135536 KB Similar Subsequence For given sequence A=(a1,a2,…,an), a sequence S=(s1,s2,…,sn) has... 阅读全文

posted @ 2017-05-17 09:43 hnust_accqx 阅读(244) 评论(0) 推荐(0)

Problem #3263 丽娃河的狼人传说 区间满足灯数,r排序后贪心。
摘要:丽娃河的狼人传说 Time limit per test: 1.0 seconds Time limit all tests: 1.0 seconds Memory limit: 256 megabytes 丽娃河是华师大著名的风景线。但由于学校财政紧缺,丽娃河边的路灯年久失修,一到晚上就会出现走在河边要打着手电的情况,不仅非常不方便,而且影响安全:已经发生了大大小小的事故多起。 方便... 阅读全文

posted @ 2017-05-16 20:35 hnust_accqx 阅读(345) 评论(0) 推荐(0)

2017-5-14 湘潭市赛 Longest Common Subsequence 想法题
摘要:Longest Common Subsequence Accepted : 7 Submit : 66 Time Limit : 3000 MS Memory Limit : 65536 KB Longest Common Subsequence Bobo has a sequence A=(a1,a2,…,an) of length n. He wo... 阅读全文

posted @ 2017-05-16 20:01 hnust_accqx 阅读(281) 评论(0) 推荐(0)

2017-5-14 湘潭市赛 Parentheses 转化思想+贪心 使括号序列合法的最小花费。满足前面左括号的数量>=有括号的数量。
摘要:Parentheses Accepted : 8 Submit : 19 Time Limit : 3000 MS Memory Limit : 65536 KB Parentheses Bobo has a very long sequence divided into n consecutive groups. The i-th group con... 阅读全文

posted @ 2017-05-16 13:27 hnust_accqx 阅读(607) 评论(0) 推荐(0)

deque双端队列用法
摘要:#include #include #include #include using namespace std; deque dq; int main() { dq.push_front(102);///插入头部 dq.push_back(101);///插入尾部 sort(dq.begin(),dq.end()); deque::iterator it ... 阅读全文

posted @ 2017-05-15 15:58 hnust_accqx 阅读(290) 评论(0) 推荐(0)

2017-5-14 湘潭市赛 Strange Optimization
摘要:Strange Optimization Accepted : 35 Submit : 197 Time Limit : 1000 MS Memory Limit : 65536 KB Strange Optimization Bobo is facing a strange optimization problem. Given n,m, he is... 阅读全文

posted @ 2017-05-15 14:40 hnust_accqx 阅读(520) 评论(0) 推荐(0)

2017-5-14 湘潭市赛 Highway 先获得直径S,T。则一开始S,T相连,然后其他的点如果离S更远那么连在S,否则T;
摘要:Highway Accepted : 33 Submit : 137 Time Limit : 4000 MS Memory Limit : 65536 KB Highway In ICPCCamp there were n towns conveniently numbered with 1,2,…,n connected with (n−1) ro... 阅读全文

posted @ 2017-05-15 14:01 hnust_accqx 阅读(310) 评论(0) 推荐(0)

2017-5-14 湘潭市赛 Partial Sum 给n个数,每次操作选择一个L,一个R,表示区间左右端点,该操作产生的贡献为[L+1,R]的和的绝对值-C。 0<=L<R<=n; 如果选过L,R这两个位置,那么以后选择的L,R都不可以再选择这两个位置。最多操作m次,求可以获得的 最大贡献和。
摘要:Partial Sum Accepted : 30 Submit : 119 Time Limit : 3000 MS Memory Limit : 65536 KB Partial Sum Bobo has a integer sequence a1,a2,…,an of length n. Each time, he selects two end... 阅读全文

posted @ 2017-05-15 13:38 hnust_accqx 阅读(3196) 评论(0) 推荐(0)

随机生成数,摘自算法竞赛入门经典P120-P123测试STL。
摘要://#include #include #include #include #include///调用time的头文件。 #include #include #include///调用rand的头文件。 #include///assert的头文件。 #define LL long long using namespace std; void fill_random_int(vector&v,i... 阅读全文

posted @ 2017-05-15 12:59 hnust_accqx 阅读(290) 评论(0) 推荐(0)

D. Powerful array 离线+莫队算法 给定n个数,m次查询;每次查询[l,r]的权值; 权值计算方法:区间某个数x的个数cnt,那么贡献为cnt*cnt*x; 所有贡献和即为该区间的值;
摘要:D. Powerful array time limit per test 5 seconds memory limit per test 256 megabytes input standard input output standard output An array of positive integers a1, a2, ..., an is given. Let us conside... 阅读全文

posted @ 2017-05-12 15:08 hnust_accqx 阅读(809) 评论(0) 推荐(0)

2038: [2009国家集训队]小Z的袜子(hose) 分块
摘要:2038: [2009国家集训队]小Z的袜子(hose) Time Limit: 20 Sec Memory Limit: 259 MB Submit: 9443 Solved: 4334 [Submit][Status][Discuss] Description 作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿。终于有一天,小Z再也无法忍受这恼人的找袜子过... 阅读全文

posted @ 2017-05-12 14:21 hnust_accqx 阅读(176) 评论(0) 推荐(0)

hdu1695 GCD2 容斥原理 求x属于[1,b]与y属于[1,d],gcd(x,y)=k的对数。(5,7)与(7,5)看作同一对。
摘要:GCD Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 10992 Accepted Submission(s): 4157 Problem Description Given 5 integers: a, b, c, d, ... 阅读全文

posted @ 2017-05-12 11:56 hnust_accqx 阅读(284) 评论(0) 推荐(0)

hdu2588 GCD 给定n,m。求x属于[1,n]。有多少个x满足gcd(x,n)>=m; 容斥或者欧拉函数
摘要:GCD Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2155 Accepted Submission(s): 1093 Problem Description The greatest common divisor GCD... 阅读全文

posted @ 2017-05-12 10:10 hnust_accqx 阅读(1269) 评论(0) 推荐(0)

导航