![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
题库
题很水
0iq2333
欢迎访问我的个人主页:0iq2333.github.io
展开
-
KMP之Power Strings
NEFU 2131 字符串乘方 模拟过程: 这道题十分巧妙地运用了next数组的性质; #include <bits/stdc++.h> using namespace std; typedef long long ll; const double PI = acos(-1.0); const int maxn = 1e6 + 5; char s[maxn]; int Next[max...原创 2020-02-20 17:13:13 · 171 阅读 · 1 评论 -
HDU、POJ贪心之旅
1、Doing Homework again(HDU 1789) 活动安排问题 题干: 一共n个作业 完成每个作业都需要一天。但是每个作业有截止日期 如果超过了截止日期 就会扣分 。 给出 n个作业的截止日期 和 如果超过截止日期要扣的分,现在要计算 怎么设计做作业的顺序扣分最少,计算出这个最少的扣分值 贪心策略: 优先让分数大的排在前面,当分数相同时,让截至日期小的排在前面。排完序后,依次完成,...原创 2020-02-02 12:21:16 · 171 阅读 · 0 评论 -
带权并查集之旅(未完待续......)
声明一下:POJ的cin,cout很难用,有时候会TLE,解除同步也不行。推荐使用scanf,printf。 1、Find them, Catch them (POJ 1703) 方法一:带权并查集 #include <iostream> #include <stdio.h> using namespace std; const int MAXN = 1e5 + 5; in...原创 2020-02-01 11:21:35 · 163 阅读 · 1 评论 -
并查集之旅
1、POJ 2524 #include <iostream> using namespace std; int s[50005], hight[50005]; void init_set(int n) { for (int i = 1; i <= n + 5; i++) { s[i] = i; hight[i] = 1; ...原创 2020-01-27 18:17:39 · 176 阅读 · 0 评论 -
vector写蛇形数组
n为行列数 #include <bits/stdc++.h> using namespace std; vector<vector<int>> a; int main() { ios::sync_with_stdio(false); int n; int i, j, t; i = j = t = 0; cin >&g...原创 2020-01-15 11:13:27 · 184 阅读 · 0 评论