上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 35 下一页
摘要: 题:https://ac.nowcoder.com/acm/contest/4137/N 分析:注意题意,收益是a[i]*a[i+1],所以分析得,是∑∑a[i]*a[j] #include<bits/stdc++.h> using namespace std; typedef long long 阅读全文
posted @ 2020-02-01 20:27 starve_to_death 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 题:http://acm.hdu.edu.cn/showproblem.php?pid=4135 题意:求[A,B]与N互质的数的个数 #include<iostream> #include<algorithm> #include<cstring> #include<cstdio> using na 阅读全文
posted @ 2020-01-31 11:27 starve_to_death 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 题:https://codeforces.com/contest/1072/problem/C 思路:首先找到最大的x,使得x*(x+1)/2 <= a+b 那么一定存在一种分割使得 a1 <= a 且 b1 <= b 证明: 从x 到 1枚举过去,对于某个i 如果 a >= i, 那么这个i放在第 阅读全文
posted @ 2020-01-29 16:20 starve_to_death 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 题:https://codeforces.com/contest/1278/problem/B 思路:还是把1~n分配给俩个数,让他们最终相等 假设刚开始两个数字相等,然后一个数字向前走了abs(b-a)步,由等差数列求和公式,这时候我们贪心的让另外一个数字走大于等于abs(b - a)的最小步数, 阅读全文
posted @ 2020-01-29 15:57 starve_to_death 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 题:http://codeforces.com/contest/1053/problem/B 题意:给定n个数,你可以对一个数的二进制形式的1移位,可执行多次这种操作,问有多少个区间满足对各数执行任意次操作后满足区间异或为0. 思路: 满足异或值为0的区间,必须满足一下条件: 1.区间中二进制1的个 阅读全文
posted @ 2020-01-29 15:52 starve_to_death 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 题:http://hihocoder.com/problemset/problem/1014 #include<bits/stdc++.h> using namespace std; #define pb push_back typedef long long ll; const int M=1e6 阅读全文
posted @ 2020-01-27 22:58 starve_to_death 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 题:https://ac.nowcoder.com/acm/contest/4010/E?&headNav=acm 分析:dsu。贪心方法:考虑插入一个值x,对总体贡献,若查找在序列中左边有值 l ,则+加上(x-l)2,若右边有值r,则加上(r-x)2,若俩边都有值,则要减去插入失去的(r-l)2 阅读全文
posted @ 2020-01-26 15:47 starve_to_death 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 题:https://codeforces.com/contest/570/problem/D 题意:给定一个以1为根的n个节点的树,每个点上有一个字母(a~z),每个点的深度定义为该节点到1号节点路径上的点数.每次询问a,b查询以a为根的子树内深度为b的节点上的字母重新排列之后是否能构成回文串. 分 阅读全文
posted @ 2020-01-26 11:39 starve_to_death 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 题:https://codeforces.com/problemset/problem/600/E 题意:一棵树有n个结点,每个结点都是一种颜色,每个颜色有一个编号,求树中每个子树的最多的颜色编号的和,对于每个结点都输出答案。 分析:考虑暴力算法,对于每个节点只是清空计数数组,再对其子树颜色进行统计 阅读全文
posted @ 2020-01-25 16:21 starve_to_death 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 题:https://ac.nowcoder.com/acm/contest/3979/F 题意:俩个序列俩俩相乘得到n*m个数,求第k大的数是哪个 分析:二分 #include<bits/stdc++.h> using namespace std; typedef long long ll; #de 阅读全文
posted @ 2020-01-22 20:40 starve_to_death 阅读(187) 评论(0) 推荐(0) 编辑
上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 35 下一页