上一页 1 ··· 8 9 10 11 12 13 下一页
  2020年4月1日
摘要: 整除分块, 就对n/i进行求和; 板子: #include<bits/stdc++.h> using namespace std; long long n,ans; int main() { scanf("%lld",&n); for(int l=1,r;l<=n;l=r+1) { r=n/(n/l 阅读全文
posted @ 2020-04-01 19:09 mmn 阅读(227) 评论(0) 推荐(0) 编辑
  2020年3月30日
摘要: poj3061 尺取法裸题,维护动态数组即可 ,l,r,sum,ans; 代码: #include <cstdio> #include <algorithm> #include <cstring> #define MAX 100005 #define LL long long #define INF 阅读全文
posted @ 2020-03-30 22:25 mmn 阅读(143) 评论(0) 推荐(0) 编辑
  2020年3月27日
摘要: 简单的板子题,就是字符串操作有点难啊啊啊, 要熟悉下离散图论里连通图(有向图)里的可达性矩阵Warshall算法,(有向图的传递闭包) 如果d[i][j]&&d[j][i]都联通,则双方可达, 此题就用一个map和string数组存储输入的字符串,flag数组标记; 代码: #include<ios 阅读全文
posted @ 2020-03-27 21:10 mmn 阅读(133) 评论(0) 推荐(0) 编辑
  2020年3月26日
摘要: 并查集+最小生成树 链接:https://www.luogu.com.cn/problem/UVA1151 先过一次kruskal,然后枚举所有的可能性找最小值 代码: #include <cstdio> #include <cmath> #include <vector> #include <cs 阅读全文
posted @ 2020-03-26 20:28 mmn 阅读(116) 评论(0) 推荐(0) 编辑
  2020年3月25日
摘要: 并查集+最小生成树水题 暴力枚举即可 链接:https://www.luogu.com.cn/problem/UVA1395 代码: #include<stdio.h> #include<algorithm> #include<iostream> #include<string.h> #includ 阅读全文
posted @ 2020-03-25 22:00 mmn 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 递归处理即可, 链接:https://www.luogu.com.cn/problem/UVA10562 注意fgets和sscanf的用法,(fgets从指定的流中读取数据,每次读一行) #include <iostream> #include <cstdio> #include <cstring 阅读全文
posted @ 2020-03-25 17:41 mmn 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 进制转换+DFS(连通块) 链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=258&page=show_problem&problem=3544 先分离成一个一个的块,之后在每个块里找空白,走 阅读全文
posted @ 2020-03-25 15:42 mmn 阅读(209) 评论(0) 推荐(0) 编辑
  2020年3月15日
摘要: 二维前缀和啊 知道这,接下来就好办了,三个数组分别记录就好 代码; #include<bits/stdc++.h> #define ll long long const int maxn=1300; const int inf=-0x3f3f3f; using namespace std; int 阅读全文
posted @ 2020-03-15 17:06 mmn 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 二维线段树和二维差分可以做,奈何本人不会 接下来就是一维差分 对每一行进行操作 map【l】+1,map【r+1】-1,即可 对每一行进行差分,最后输出(define那里long long和ll位置反了... 代码: 原题链接:https://www.luogu.com.cn/problem/P33 阅读全文
posted @ 2020-03-15 16:09 mmn 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 让找连续子段的最大和 1.首先想到的就是暴力枚举(测试点全都过不了)(还是太菜了) 时间复杂度太大 思路:枚举字串首尾两端的,找出不同的字串逐一相加 代码: 简单的想一下,1中做了许多重复的计算 2,当子序列的起始位置不变,末尾移动的时候,nowsum只会依次加上一个新的数,所以简单枚举 一下字串首 阅读全文
posted @ 2020-03-15 00:13 mmn 阅读(280) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 下一页