自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(18)
  • 问答 (1)
  • 收藏
  • 关注

原创 警醒zz的自己

P1462 通往奥格瑞玛的道路二分 迪杰斯特拉 最短路堆优化的时候扔进去{dis[e[i].v],e[i].v}#include<bits/stdc++.h> using namespace std;typedef long long ll;typedef pair<int,int > pii;typedef double db;#define rep(i,s,t) for(int i=s;i<=t;i++)#define per(i,s,t) for(int

2021-03-03 21:20:25 112 1

原创 DP 2

单调区间最大子序和#include<algorithm>#include<climits>#include<deque>#include<iostream>using namespace std;const int N=3e5+10;typedef long long ll;int n,m;deque<int> q;ll s[N];int main(){ cin>>n>>m;

2021-03-03 17:06:49 84

原创 2021-03-02

质数距离#include <cstring>#include <iostream>#include <algorithm>using namespace std;typedef long long LL;const int N = 1000010;int primes[N], cnt;bool st[N];void init(int n){ memset(st, 0, sizeof st); cnt = 0; for

2021-03-02 21:30:56 70

原创 计算几何 1

点和向量const double eps = 1e-10;struct Point{ double x,y; Point(){} Point(double _x,double _y):x(_x),y(_y){}};typedef Point Vector;//直线struct Line { Point s, e; Line() {} Line(Point a, Point b) {s = a, e = b;}};Vector operator+(const Vect

2021-03-02 18:48:18 115

原创 DP 1

最长上升子序列int mx = 1; // 找出所计算的f[i]之中的最大值,边算边找 for (int i = 0; i < n; i++) { f[i] = 1; // 设f[i]默认为1,找不到前面数字小于自己的时候就为1 for (int j = 0; j < i; j++) { if (w[i] > w[j]) f[i] = max(f[i], f[j] + 1); // 前一个小于自己的数结尾的

2021-03-02 17:28:17 83

原创 数据结构——图的灵界矩阵存储

#include <iostream>using namespace std;const int DefaultVertices = 100;const int maxWeight = 1000;template<class T,class E>class Graphmtx {public: Graphmtx(int sz = DefaultVertices); ~Graphmtx() { delete[]VerticesList;

2021-02-14 11:13:35 158

原创 数据结构——二叉搜索树

不会写的,算导上有意外收获#include<iostream>template <class E,class K>struct BSTNode{ E data; BSTNode<E,K> *left,*right; BSTNode():left(NULL),right(NULL){} BSTNode(const E d,BSTNode<E,K> *L=NULL,BSTNode<E,K> *R=NULL):data(

2021-02-13 20:33:27 51

原创 数据结构——并查集

const int DefaultSize = 10;class UFSets {public: UFSets(int sz = DefaultSize); ~UFSets() { delete[] parent; } int Find(int x); void Union(int Root1, int Root2);private: int* parent; int Size;};void UFSets::Union(int Root1, int

2021-02-13 17:38:23 72

原创 数据结构——最小堆

优先队列懒得打了#include <iostream>//#include<priority_queue>using namespace std; const int DefaultSize=10;template<class T>class MinHeap {public: MinHeap(int sz = DefaultSize); //构造函数:建立空堆 MinHeap(T arr[], int n); //构造函数:通过一个数组创建堆 ~M

2021-02-13 17:23:31 152

原创 数据结构——二叉树

代码参考清华大学出版社的数据结构,吐了#include <iostream>#include <cstdlib>#include <stack>#include <deque>using namespace std;template<class T>struct BinTreeNode { //广义表 T data; BinTreeNode<T>* leftChild, * rightChild;

2021-02-10 13:31:07 75

原创 数据结构——三元组实现稀松矩阵

#include <iostream>using namespace std;const int DefaultSize = 100;typedef int dt;struct Trituple {//三元组 int row, col; dt value; /*Trituple& operator=(Trituple& x) { row = x.row, col = x.col, value = x.value; }*/

2021-02-09 21:53:23 210

原创 数据结构——队列

循环队列#include <iostream>#include <cassert>using namespace std;typedef int dt;const int maxSize = 50;class Queue {public: Queue(){} ~Queue(){} virtual void EnQueue(const dt& x) = 0; virtual bool DeQueue(dt& x) = 0;

2021-02-09 21:51:16 70

原创 数据结构——栈

顺序栈#include <string>#include <iostream>#include <cstdio>using namespace std;typedef int DataType;class Node{public: DataType data; Node *next;};class List{public: List(); ~List(); int Create(int size); int makeEmpty()

2021-02-09 21:49:35 99

原创 数据结构——链表

单链表#include <iostream>using namespace std;typedef int dt;struct Node { Node* link; dt data; Node(Node* ptr = NULL) { link = ptr; } Node(const dt& item, Node* ptr = NULL) { data = item, link = ptr; }};class List {public:

2021-02-09 21:47:31 126

原创 牛客2020跨年场

新年接着爬A题最难了,抄个答案DABCDDAABCCBCDDACCDADB 牛牛想起飞int main(){ ios::sync_with_stdio(false); int n,y; cin>>n>>y; //y是取模数 for(int i=1;i<=n;++i) cin>>a[i]; for(int i=1;i<=n;++i) cin>>b[i];//a和b

2021-01-01 09:20:49 306

原创 线段树学习记录1

树struct Node{ int l,r; int data;}t[Max*4];因为左儿子和右儿子编号分别是父亲2和父亲2+1所以要*4建树void build(int p,int l,int r){ t[p].l=l; t[p].r=r; if(l==r){ //具体操作 pushup return ; } int mid=(l+r)/2; build(p*2,l,mid); build(p*2+1,mid+1,r); //具体操

2020-12-27 15:03:19 106

原创 2020年浙大城市学院新生程序设计竞赛(同步赛)

这个比赛好芳香 啊啊啊啊 压力马斯达2020年浙大城市学院新生程序设计竞赛同步赛A 年轻人是不讲5的众所周知,年轻人是不讲5的。作为年轻人,你应该继承这样的“优良传统”。给定一个数串,输出时将其中的数字’5’替换成字符’*’。签到题string s; cin>>s; int l=s.size(); for(int i=0;i<l;i++){ if(s[i]=='5')s[i]='*'; } cout<<s<<endl;B 计算函数最大

2020-12-27 11:11:58 1810 1

原创 2020年广东工业大学第十届文远知行杯新生程序设计竞赛(同步赛)

第一次水题解,尽管还有三不会链接 :https://ac.nowcoder.com/acm/contest/9692A肥猪的钢琴床做的时候没想到dp,直接模拟转化后的字符串可化为 000111000三段,每一段的长度都可能为0dp数组记录第i个处于第1/2/3段需要删除的最小字符(第个字符可能要被删除)正解是dpif(s[i]=='1') { dp[i][0]=dp[i-1][0]+1; dp[i][1]=min(dp[i-1][0],dp[i-1

2020-12-07 23:28:06 554

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除