- 博客(67)
- 收藏
- 关注
原创 dd 命令
注意在写文件的时候bs=512不要动,count根据输入文件实际大小变动,输出的起始位置其实是(seek-1)*bs,因此你应该改动count而不是根据输入文件调整块大小!conv = notrunc 不截短输出文件。seek=从第几块开始写。count=写入的块数。格式化(头部100M)
2023-07-02 10:29:05
473
原创 ucore lab6
然后挂上代码留个备份,以备日后查阅吧,有一部分参考了answer,这玩意不看不行啊,好多测试样例根据他的代码给出的,不同的策略结果不同就拿不到分啊,但是也大差不差,就是总以为自己写错了,其实只是策略不同,不必太深究。只能说这个项目很坑啊啊啊啊啊啊,除了写明我们需要修改的地方之外,answer和源码有很多不一样的地方,而且不知道是干什么用的,需要你自己找出不同来再插到源码上,否则项目起不来,具体过程就是很艰辛啊。源码这个斜堆也有比较值得学习的地方,直接拿过来了。中间很多杂事,这次终于对接了lab6。
2023-03-11 17:26:47
147
原创 E. Monsters (hard version)
这调试的代码成功让他上了个百行,炸裂,感觉有一次可以解的算法,懒得想了,线段树+树状数组你俩辛苦下搁着磨吧。离开集训队好长时间了,也很长时间没有碰这些代码了,最近觉得码力掉了很多,决定操练起来。ps 这bug调的整个人裂开,一瓶酒一包烟,一个算法写一天。
2023-02-13 20:01:57
322
原创 ucore 内核线程创建
复制原进程的内存管理信息到新进程(但内核线程不必做此事)调用alloc_proc,首先获得一块用户信息块。复制原进程上下文到新进程。为进程分配一个内核栈。将新进程添加到进程列表。
2023-02-04 16:00:55
175
原创 D. Dog Walking
我们知道在最大值和最小值之外我们进行加减对答案是不影响的,而对于两个极值内部,我们一定会让他尽最大努力向一个方向走,因此我们可以把同一方向的放在一块。但是我们不知道极值在哪里,只知道结构,所以我们循环整个取值去尝试找到最大值就好了,答案一定是其中之一的情况/*input3 1001 2 -3*/#include<iostream>#include<algorithm>#include<cstring>using namespace std;.
2022-05-17 15:59:42
232
原创 Codeforces Round #785 (Div. 2) A~F
小细节卡的挺难受呀A. Subtle Substring SubtractionAlice肯定一下取走尽可能多的数/*input5abaabccbancodeforces*/#include<bits/stdc++.h>using namespace std;const int N=2e5+10;char s[N];int main(){ int t; cin>>t; while(t--) { int sum=0; scanf("
2022-05-06 22:25:22
556
原创 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
394
原创 估计是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
559
原创 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
853
原创 笛卡尔树儿
键值二元组(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
492
原创 差分加模拟
题目#include<bits/stdc++.h>using namespace std;const int N=1e5+10;int qz[N],hz[N];int cnt[N],sum[N];void update(int l,int r,int x,int *p){ p[l]+=x; p[r+1]-=x;}int main(){ int t; cin>>t; while(t--) { int n,m,q; scanf("%d%d%d",&
2021-12-13 11:13:53
1021
原创 树状数组区间修改求和
/*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
471
原创 数据库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
22022
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
183
原创 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
385
原创 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
184
原创 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
165
原创 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
224
原创 前缀和给我写麻了
#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
91
原创 字符串删除特定字母大模拟
#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
125
原创 C - Count Triangles
Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A≤B≤C≤D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sides x, y, and z exist, such that A≤x≤B≤y≤C≤z≤D holds?Yuri is prepari
2021-08-03 21:17:59
216
原创 成功上车线段树,留个纪念
#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
104
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人