C/C++
语言与算法相关
ಠ_ರೃ大跌眼镜
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
数据库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 · 22272 阅读 · 6 评论 -
E. Monsters (hard version)
这调试的代码成功让他上了个百行,炸裂,感觉有一次可以解的算法,懒得想了,线段树+树状数组你俩辛苦下搁着磨吧。离开集训队好长时间了,也很长时间没有碰这些代码了,最近觉得码力掉了很多,决定操练起来。ps 这bug调的整个人裂开,一瓶酒一包烟,一个算法写一天。原创 2023-02-13 20:01:57 · 365 阅读 · 0 评论 -
E1. Asterism(easy&hard)
E1. Asterism (Easy Version) time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output This is the easy version of the problem. The difference between versions is the constraints on n and ai . You can make原创 2021-10-25 21:50:32 · 228 阅读 · 0 评论 -
D. Dog Walking
我们知道在最大值和最小值之外我们进行加减对答案是不影响的,而对于两个极值内部,我们一定会让他尽最大努力向一个方向走,因此我们可以把同一方向的放在一块。 但是我们不知道极值在哪里,只知道结构,所以我们循环整个取值去尝试找到最大值就好了,答案一定是其中之一的情况 /*input 3 100 1 2 -3 */ #include<iostream> #include<algorithm> #include<cstring> using namespace std; .原创 2022-05-17 15:59:42 · 259 阅读 · 0 评论 -
Codeforces Round #785 (Div. 2) A~F
小细节卡的挺难受呀 A. Subtle Substring Subtraction Alice肯定一下取走尽可能多的数 /*input 5 aba abc cba n codeforces */ #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 · 590 阅读 · 0 评论 -
Codeforces Round #751 (Div. 2) D. Frog Traveler
D. Frog Traveler time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Frog Gorf is traveling through Swamp kingdom. Unfortunately, after a poor jump, he fell into a well of n meters depth. Now Gorf i原创 2021-10-25 22:41:06 · 413 阅读 · 0 评论 -
线段树区间修改查询懒标记
打卡原创 2022-06-11 19:44:41 · 134 阅读 · 0 评论 -
欧拉筛和埃氏筛求质因子个数
埃氏筛法简单易懂直接上代码 void solve() { for(int i=2;i<=20000000;i++) if(!test[i]) for(int j=i;j<=20000000;j+=i) test[j]++; } 欧拉筛: 根据算法原理将一个非质数通过他的最小质因子筛出,留下的便是质数,s=ip如果p小于i的最小质因子s的质因子比i多1,否则相等。那么: void solve() { int原创 2021-03-31 12:53:19 · 737 阅读 · 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 · 158 阅读 · 0 评论 -
树状数组区间修改求和
/*input 10 7 3 2 4 8 8 7 8 4 8 10 1 1 7 1 1 3 1 6 10 1 5 6 2 1 2 2 1 5 6 1 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 · 504 阅读 · 0 评论 -
差分加模拟
题目 #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 · 1056 阅读 · 0 评论 -
st表查询区间最大最小值
数据结构原创 2022-06-08 21:22:52 · 326 阅读 · 0 评论
分享