[hdu4630] No Pain No Game】的更多相关文章

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4630 题意:给你n个数据范围在[1,n]中的数,m个操作,每个操作一个询问[L,R],让你求区间[L,R]内任意两个数的最大公倍数. 思路:是线段树是必然的 O.O .顺着来不好解决,只能离线处理试试.按r从小到大排序,数组a[i]从左到右扫一遍,对每个a[i]都要进行处理,先因数分解,pre[X]表示约数X在前面最后出现的位置.开始处理的是pre[X]到当前位置r都对约数X进行比较更新,后面想想这…
某次模拟赛的T1. 刚开始怀疑是RMQ......我真是太弱了QAQ 题目传送门 正解是离线操作,把所有询问按r从小到大排序. 然后把数从左到右处理,处理完第i个数,就可以回答所有r==i的询问了. 分解因数,记录下来每个因数上一次出现的位置. 又遇到这个因数,就把上一次的位置加进线段树,把这一次的位置记录下来. 这样线段树里有这个数当且仅当这个数出现了两次以上. 此时这个数显然是备选的合法答案之一,然后询问的时候询问区间最大值就行了. #include<cstdio> #include<…
HDU-4622 Reincarnation 题意:给定一个字符串,有Q次询问,每次询问得出区间[L, R]内有多少个不同的子串. 分析:后缀数组搞,不过hash+dp也能够搞定这题,详解见http://www.cnblogs.com/Lyush/p/3233573.html. #include <cstdlib> #include <cstring> #include <cstdio> #include <cmath> #include <algor…
Your pain is the breaking of the shell that encloses your understanding. 你的痛苦是你那包裹知识的皮壳的破裂.…
No Pain No Game Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1465    Accepted Submission(s): 631 Problem Description Life is a game,and you lose it,so you suicide.But you can not kill yoursel…
hdu4630:http://acm.hdu.edu.cn/showproblem.php?pid=4630 题意:给定一个排序,求区间最大GCD. 题解:离散树状数组.首先把查询按左端点从大到小排序.然后用树状数组来维护每个位置出现的最大的公约数.枚举每个数的约数,记录到当前位置为止,上一个x的倍数出现的位置b[x]; #include<iostream> #include<algorithm> #include<cstdio> #include<cstring…
For a guy who has experienced his fair share of mysteries,on mystery,I still can't figure out is why some people come into our lives.Why some people go,and others become a part of you.Some friendships feel like they'll last forever.And others end far…
    1● alb   2● write =====>rait     1● alg 2● pain   痛,疼痛           1● alt 2● high   高         1● ampl   2● large   =====>la:dʒ 大                 1● adip 2● fat =====>fæt 肥   lose weight 减肥         1● in =====>在~之内:按照(表示方式) 2● crease =====>…
Pain and Pain Management 疼痛与疼痛管理 ①Years ago,doctors often said that pain was a normal part of life.In particular,when older patients complained of pain,they were told it was a natural part of aging and they would have to learn to live with it. ②Time…
No Pain No Game Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17    Accepted Submission(s): 5 Problem Description Life is a game,and you lose it,so you suicide.But you can not kill yourself be…