暴力枚举
狠人王
怀着一颗热情的心,追随自己的梦想!
展开
-
值得多看的代码
#include <bits/stdc++.h> #define maxn 105 using namespace std; int n; int pre[maxn]; string str; int main() { scanf("%d",&n); cin>>str; int len = str.length(); int nu...原创 2019-05-24 10:35:03 · 165 阅读 · 0 评论 -
CodeForce 224B Array(优化前缀和|枚举)
You’ve got an array a, consisting of n integers: a1, a2, …, an. Your task is to find a minimal by inclusion segment [l, r] (1 ≤ l ≤ r ≤ n) such, that among numbers al, al + 1, …, ar there are exact...原创 2019-07-25 17:16:02 · 182 阅读 · 0 评论 -
LightOJ Circle in Square (简单计算几何)
A circle is placed perfectly into a square. The term perfectly placed means that each side of the square is touched by the circle, but the circle doesn’t have any overlapping part with the square. See...原创 2019-08-01 15:52:35 · 264 阅读 · 0 评论 -
【51nod】2651 区间和的和
输入一个长度为n的数组a,a包括(n+1)n/2个区间。每个区间所有数的和,被称为区间和,求所有(n+1)n/2个区间和的和。由于数值较大,输出mod 1e9+7的结果。 例如: 3个数1 2 3,共有6个子区间,包含的数字如下: {1} {2} {3} {1 2} {2 3} {1 2 3},这些区间求和为1 2 3 3 5 6,这6个数字再求和为20. 收起 输入 第一行一个整...原创 2019-09-09 19:30:39 · 806 阅读 · 0 评论 -
2019icpc上海网络赛 Digit sum(预处理)(数位dp)
https://nanti.jisuanke.com/t/41422 题意:直接看图,简单明了 分析: 这个我觉得有必要从时间复杂度层面分析这道题目。首先如果是无脑采取暴力的做法,时间复杂度是O(1e5*1e6),必然超时,做都不用做,肯定要换算法或者优化。我们可以观察到本题有T(100000)种case,如果我们每次case都要对N这么大的范围进行暴力操作查找,那么肯定是会超时的,所以...原创 2019-09-17 22:15:56 · 245 阅读 · 0 评论