2017年5月15日

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 阅读(506) 评论(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 阅读(297) 评论(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 阅读(3152) 评论(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 阅读(284) 评论(0) 推荐(0) 编辑

2017年5月12日

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 阅读(791) 评论(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 阅读(169) 评论(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 阅读(271) 评论(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 阅读(1240) 评论(0) 推荐(0) 编辑

2017年4月27日

Trees in a Wood. UVA 10214 欧拉函数或者容斥定理 给定a,b求 |x|<=a, |y|<=b这个范围内的所有整点不包括原点都种一棵树。求出你站在原点向四周看到的树的数量/总的树的数量的值。

摘要: /** 题目:Trees in a Wood. UVA 10214 链接:https://vjudge.net/problem/UVA-10214 题意:给定a,b求 |x| #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsign... 阅读全文

posted @ 2017-04-27 19:11 hnust_accqx 阅读(187) 评论(0) 推荐(0) 编辑

Magical GCD UVA 1642 利用约数个数少来优化 给定n个数,求使连续的一段序列的所有数的最大公约数*数的数量的值最大。输出这个最大值。

摘要: /** 题目:Magical GCD UVA 1642 链接:https://vjudge.net/problem/UVA-1642 题意:给定n个数,求使连续的一段序列的所有数的最大公约数*数的数量的值最大。输出这个最大值。 思路: 从左到右枚举一段连续序列时候,同时不断取gcd,会发现gcd相同的部分。 gcd的值会随着长度边长非递增变化。最多logx个不同的gcd。那么对于一个长长的序列。... 阅读全文

posted @ 2017-04-27 18:51 hnust_accqx 阅读(377) 评论(0) 推荐(0) 编辑

导航