笔记
ಠ_ರೃ大跌眼镜
这个作者很懒,什么都没留下…
展开
-
ucore lab6
然后挂上代码留个备份,以备日后查阅吧,有一部分参考了answer,这玩意不看不行啊,好多测试样例根据他的代码给出的,不同的策略结果不同就拿不到分啊,但是也大差不差,就是总以为自己写错了,其实只是策略不同,不必太深究。只能说这个项目很坑啊啊啊啊啊啊,除了写明我们需要修改的地方之外,answer和源码有很多不一样的地方,而且不知道是干什么用的,需要你自己找出不同来再插到源码上,否则项目起不来,具体过程就是很艰辛啊。源码这个斜堆也有比较值得学习的地方,直接拿过来了。中间很多杂事,这次终于对接了lab6。原创 2023-03-11 17:26:47 · 84 阅读 · 0 评论 -
E. Monsters (hard version)
这调试的代码成功让他上了个百行,炸裂,感觉有一次可以解的算法,懒得想了,线段树+树状数组你俩辛苦下搁着磨吧。离开集训队好长时间了,也很长时间没有碰这些代码了,最近觉得码力掉了很多,决定操练起来。ps 这bug调的整个人裂开,一瓶酒一包烟,一个算法写一天。原创 2023-02-13 20:01:57 · 181 阅读 · 0 评论 -
页面置换算法
【代码】页面置换算法。原创 2023-02-04 16:35:06 · 57 阅读 · 0 评论 -
ucore 内核线程创建
复制原进程的内存管理信息到新进程(但内核线程不必做此事)调用alloc_proc,首先获得一块用户信息块。复制原进程上下文到新进程。为进程分配一个内核栈。将新进程添加到进程列表。原创 2023-02-04 16:00:55 · 131 阅读 · 0 评论 -
ucore 操作系统os first-fit 算法实现
【代码】ucore 操作系统os first-fit 算法实现。原创 2023-01-21 23:36:49 · 112 阅读 · 0 评论 -
st表查询区间最大最小值
数据结构原创 2022-06-08 21:22:52 · 195 阅读 · 0 评论 -
c++程序计时
/*input*/#include<iostream>#include<ctime>using namespace std;int main(){ clock_t startTime,endTime; startTime = clock();//计时开始 //printf("%ld\n",__STDC_VERSION__); long long a,b=0; for(long long a=1;a<=1e10;a++,b++); endTime = c原创 2022-04-13 21:18:59 · 341 阅读 · 0 评论 -
估计是2022写的最多的代码了吧
蓝桥杯4.9仅留念用(似乎这一天带有很多色彩不是吗)#include<iostream>using namespace std;const int N= 200010;long long a[N];long long qz[N];int main(){ int n; cin>>n; long long ans=0; for(int i=1;i<=n;i++) scanf("%d",a+i); for(int i=1;i<=n;i++) qz[.原创 2022-04-10 15:33:04 · 502 阅读 · 0 评论 -
c++文件写入模板
#include<ctime>#include<fstream>#include<string>#include<sstream>#include<iostream>using namespace std;int main(){ int t; t=20; unsigned seed; seed=time(0); srand(seed); while(t--) { ofstream file; ostringst原创 2022-03-27 10:35:01 · 785 阅读 · 0 评论 -
笛卡尔树儿
键值二元组(u,v)笛卡尔树有以下性质u满足二叉搜索树的性质v满足堆性质中序遍历得原序列/*input119 3 7 1 8 12 10 20 15 18 5*/#include<iostream>using namespace std;const int N=100;int a[N];int ls[N],rs[N],st[N],top=0;int main(){ int n; cin>>n; for(int i=1;i<=原创 2022-01-23 10:55:41 · 439 阅读 · 0 评论 -
树状数组区间修改求和
/*input10 73 2 4 8 8 7 8 4 8 101 1 71 1 31 6 101 5 62 1 2 21 5 61 5 6*/#include<iostream>using namespace std;const int N=1e7+10;const int mod=998244353;bool p[N];int prime[N],s[N],cp;long long tree[4][N];int lowbit(int x){return x&a原创 2021-12-12 23:04:33 · 430 阅读 · 0 评论 -
数据库mysql课程设计
#include<stdio.h>#include<string.h>#include"mysql.h"#include<stdlib.h>#include<math.h>#include<iostream>#include<string>using namespace std;#define _HOST_ "127.0.0.1"#define _DB_ "db1"char _USER_[30];char _P原创 2021-12-08 21:12:23 · 21133 阅读 · 6 评论 -
E - Common Number
考虑没一个数的贡献度,贡献度>=k的最大值自然就是答案首先奇数x可以从x2跳转过来偶数y可以从y+1,y2跳转过来例如3由6跳转过来,6由7和12跳转过来,那么说3对于6、7、12…产生贡献列出1~4的贡献度找规律1 : 1 2 3 4 5 6 7 8 9 10 …n2 : 2 3 4 5 6 7 8 9 10 11…n3 : 3 6 7 12 13 14 15 24…n4 : 4 5 8 9 10 11 16 17 18…n我们把数值分组为x~,x2 ~ , x4 ~ ,x*8…原创 2021-11-17 14:05:21 · 133 阅读 · 0 评论 -
Codeforces Round #751 (Div. 2) D. Frog Traveler
D. Frog Travelertime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputFrog Gorf is traveling through Swamp kingdom. Unfortunately, after a poor jump, he fell into a well of nmeters depth. Now Gorf i原创 2021-10-25 22:41:06 · 304 阅读 · 0 评论 -
E1. Asterism(easy&hard)
E1. Asterism (Easy Version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the easy version of the problem. The difference between versions is the constraints on nand ai. You can make原创 2021-10-25 21:50:32 · 123 阅读 · 0 评论 -
n+m*m
for (int i = 1; i <= n; ++i) { cin >> x; for (auto key : g[x]) { int to = (key^x); ans[to] = 1; while (r[to] > x) { r[to]--; if (r[to] != x) g[r[to]].push_b...原创 2021-10-25 11:03:56 · 120 阅读 · 0 评论 -
2021-10-16最大公约数
给定两个正整数 a,m,其中 a<m。请你计算,有多少个小于 m的非负整数 x满足:gcd(a,m)=gcd(a+x,m)输入格式第一行包含整数 T,表示共有 T组测试数据。每组数据占一行,包含两个整数 a,m。输出格式每组数据输出一行结果,一个整数,表示满足条件的非负整数 x的个数。数据范围前三个测试点满足,1≤T≤10。所有测试点满足,1≤T≤50,1≤a<m≤1010。输入样例:34 95 1042 9999999967输出样例:61原创 2021-10-16 23:29:30 · 174 阅读 · 0 评论 -
前缀和给我写麻了
#include<iostream>#include<cstring>#include<algorithm>using namespace std;char mp[410][410];int b[410][410],w[410][410];int u[410],d[410];int n,m;int calw(int x1,int y1,int x2,int y2){ return w[x2][y2]-w[x1-1][y2]-w[x2][y1-1]+原创 2021-10-02 14:36:11 · 57 阅读 · 0 评论 -
字符串删除特定字母大模拟
#include<iostream>#include<algorithm>#include<cstring>using namespace std;const int N=5e5+10;int a[30],xl[30],sl;bool f[30];char s[N],b[N];void sub(int x,int l){ int L=1,R=1; while(R<=l) { while(R<=l&原创 2021-09-16 21:45:47 · 84 阅读 · 0 评论 -
成功上车线段树,留个纪念
#include<iostream>#include<cmath>using namespace std;const int N=2e5+10;long long a[N],sub[N];long long lz[N];int n;long long tree[N<<2]; inline long long query(int l,int r,int L,int R,int top); inline long long gcd(long long原创 2021-08-02 16:32:00 · 76 阅读 · 0 评论 -
写好优化我不用,就是玩
dfs剪枝,优先遍历情况少的状态#include<iostream>#include<algorithm>using namespace std;int mp[10][11],H[10],L[10],O[10],ans=-1,ss[11][11],up[10];int score[10][10]={{0,0,0,0,0,0,0,0,0,0},{0,6,6,6,6,6,6,6,6,6},{0,6,7,7,7,7,7,7,7,6},{0,6,7,8,8,8,8,8,7,原创 2021-06-13 23:44:32 · 82 阅读 · 1 评论 -
2021.6.1C树上dp
#include<iostream>using namespace std;const int N=2e5+10;int n,k;int ne[N<<1],hd[N<<1],to[N<<1],idx;void add(int x,int y){ ne[++idx]=hd[x]; hd[x]=idx; to[idx]=y;}long long sum[N][7];long long ans;void solve(int原创 2021-06-02 16:40:13 · 69 阅读 · 0 评论 -
树上背包2021.5.27
#include<iostream>#include<cstring>#include<cmath>using namespace std;int dp[3010][3010],sum;int mo[3010],leaf[3010];int ne[3010],to[3010],idx,hd[3010],v[3010];int ans;void add(int x,int y,int t){ ne[++idx]=hd[x]; hd[x]=i原创 2021-05-27 16:32:47 · 61 阅读 · 0 评论 -
主席树模板
5.3解锁新姿势弱弱也会主席树啦#include<iostream>#include<vector>#include<algorithm>#include<cstring>using namespace std;const int N=100010;struct Node{int l,r;int cnt;}tr[N*4+N*17];vector <int> num;int a[N],idx,root[N];int原创 2021-05-03 19:47:31 · 105 阅读 · 0 评论 -
E - Bin Packing Problem
E - Bin Packing ProblemLzw is having the Operations Research class now. Today the teacher is talking about the bin packing problem and some approximation algorithms to solve it.In the bin packing problem, items of different volumes must be packed into a原创 2021-04-20 20:04:32 · 322 阅读 · 1 评论 -
P2345 [USACO04OPEN]MooFest G
归并排序+分治#include<iostream>#include<algorithm>using namespace std;long long ans=0;long long qz[20010];struct bill{int v,s;}b[20010],tmp[20010];bool cmp1(bill &a,bill &b){return a.v<b.v;}void solve(int l,int r){ if(l==r)原创 2021-04-17 10:05:03 · 161 阅读 · 0 评论 -
P1966 [NOIP2013 提高组] 火柴排队
https://www.luogu.com.cn/problem/P1966重置大小关系+树状数组求逆序对#include<iostream>#include<algorithm>using namespace std;const int mod=1e8-3;struct qr{int l;int r;}a[100010],b[100010];bool cmp(qr x,qr y){ if(x.l==y.l) return x.r<y.r;原创 2021-04-16 16:14:26 · 145 阅读 · 0 评论