自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(36)
  • 资源 (40)
  • 收藏
  • 关注

原创 抗压题解解题压抗1

这波就不打题号了[POI2001][HAOI2007]反素数https://www.luogu.com.cn/problem/P1463https://www.luogu.com.cn/problem/P1463 题解: 开始拿到这道题的时候毫无头绪,然而旁边两人都秒了,这波直接心态炸掉,无奈自己自己没做过TAT,好吧,其实这道题是可以打表的,而且并不是很慢 打表程序:#include<cstdio>#include...

2021-10-09 16:59:42 214

原创 杂题题解(康复训练)

目录关于10.05标准化测试: T1: 题目描述: 题解:T2: 题目描述:前置知识及证明(话说我是真的屑,初中白学了?)关于10.05标准化测试: T1: 题目描述:[HNOI2011]数学作业 - 洛谷https://www.luogu.com.cn/problem/P3216 题解: ...

2021-10-08 10:04:29 180

原创 9.16集训小结

刚被搜索给暴揍了之后,又来挨数据结构的打QAQTwT昨天饱受TLE之快,今天尽观RE之美T1:T1http://118.31.67.228/problem.php?cid=1025&pid=0样例输入:5 102 3 71 32 4 73 3 6 107 1 2 3 4 7 8 960 3 3 4 50 3 1 3 41 2 1 30 1 51 1 21 2 3 5样例输出:51 2 5 8 975 6 1034 7题

2021-09-17 17:12:03 135 1

原创 9.14~9.15集训小结

搜索TwT今天化身WA队金牌剪枝园丁疯狂TLEDay1T1:Day1T1http://118.31.67.228/problem.php?cid=1020&pid=0样例输入:5 3样例输出 : 1 2 3 1 2 4 1 2 5 1 3 4 1 3 5 1 4 5 2 3 4 2 3 5 2 4 5 3 4 5题解: 三年前可以写出来的题,不会现在写不出来...

2021-09-17 11:42:27 117

原创 一些有用的OI小技巧

C++计算程序片断时间为了测试(比较)自己程序的效率,我们可以用头文件ctime里面的clock()函数进行测试具体用法:clock_t t;t=clock();t=clock()-t;cout<<"时间为:"<<(((float)t)/CLOCKS_PER_SEC*1000)<<"ms\n";这里CLOCKS_PER_SEC可以理解为一个时间单位,但是不是平常的,是计算机cpu里面的时间单位,所以除一个,然后*1000(换算成ms...

2021-09-14 21:32:07 252

原创 9.13集训小结

T1:第一题样例输入:30011011001 1 3 3样例输出:4题解: 老DFS一分没有了直接用BFS跑一遍注意还是要取最小的那一个点,ans还是要加一个取min(按理说不用) 注意!!!网上提交请记得关freopen#include<cstdio>#include<queue>#include<cstring>#include<string>using n...

2021-09-14 18:23:01 88

原创 9.9题解

T1:第一题样例输入:7155 2 312 4 510 0 021 0 015 6 78 0 023 0 0 样例输出:4题解: 对于一切二叉树的题目,我就不要用链式前项星来存图,直接对于对于每一个点,存储它的左儿子和右儿子,这样方便跑图并且可以保证先序/中序/后序输出的顺序的正确性#include<cstdio>using namespace std;struct Node{ int l,r;}tr[10...

2021-09-11 07:28:05 104

原创 %斜率优化%

站在巨人肩上!以后怎么用: 但凡出现dp得分计算公式中有平方,可以化简成为:​​​​​​​​​​​​​​​​​​​​​ 的形式就可以用斜率优化斜率优化的精髓就在将上面的公式求出来,并且利用单调队列#include<cstdio>using namespace std;int n,L;long long C[100100];long long dp[10...

2021-09-09 17:26:12 54

原创 9.8集训小结

今天是图论专题拓扑排序可以拿来求自环(我是伞兵Dj的入队操作要放在if(dis[v]>dis[now]+tr[i].val)里面T1:第一题样例输入:513 2 3 4 0 012 4 520 0 040 0 0样例输出:81题解: 法1:这是一道简单的二叉树应用问题,问题中的结点数并不多,数据规模也不大,采用邻接矩阵存储,用Floyed算法(上网查阅)求出任意两结点之间的最短路径,然后穷举医院可能...

2021-09-08 20:22:29 162

原创 9.7集训小结

T1:第一题样例输入:1 6 7 3样例输出:2题解:显然前两行都与前面的数有关,就猜测第三行也与前面的数有关,于是得到第四行。很明显可以发现第四行aa的系数比第三行多11,bb的系数比第三行少11。所以不用管前两行,把第三行直接列出来就行了。方程:sum1[i]=sum1[i-1]+sum1[i-2]-1;//前两个的和-1sum2[i]=sum2[i-1]+sum2[i-2]+1;//前两个的和+1这道题刚开始想...

2021-09-08 18:26:02 89

原创 9.6集训小结

今天被DP恶心吐了T1:第一题样例输入:44 5 9 4样例输出:4354题解:这是一道典型的区间DP,通过小区间向大区间推出答案。不过要注意的是不能枚举两端点的长度,而要先枚举区间长度然后枚举左端点,这样遵循了从小到大的顺序,直接是l,r会出现更新此区间时,小区间未更新的情况。#include<cstdio>#include<algorithm>#include<cstring>#inclu...

2021-09-07 17:23:11 65

原创 9.3单题集训小结

T3:是的这道题并不是第一题,但是,这是今天收获较大的一道。关于通过二叉树先序遍历和中序遍历求出树的样子这件事,通过这道题,有了阶梯性的进步,得知了这个方法,对于以后的一系列此类问题,都可以用此方法进行举一反三;思路:通过先序遍历对树之中的根和子树的根一一求出进行辅助,再用中序遍历递归,找到一个根,由于是中序遍历,所以这个数的左边所有数都是它的左子树子孙节点,右边则是它右子树子孙节点,这样就可以递归建树了。#include<cstdio>#include<stri.

2021-09-06 17:03:38 65

原创 9.2集训小结QAQ

又是WA题的一天T1:很烦的模拟题,不多说,特判闰年、大月、小月#include<cstdio>using namespace std;int a[9],b[9];int x,y;int ans=0;int pd[14];int main(void){ scanf("%d%d",&x,&y); for(int i=8;i>=5;i--)a[i]=x%10,x/=10; for(int i=8;i>=5;i--)b[i..

2021-09-02 20:55:34 79

原创 9.1集训小结TAT

T1:是一道简单的实数二分,不多说,注意精度问题!!#include<cstdio>#include<cmath> using namespace std; double emo=0.000000000001;//精度double L,R; inline double f(double x){ return (double)exp(x*log(2))+exp(x*log(3))-exp(x*log(4))//等于2的x次幂+3的x次幂-4的x次幂;

2021-09-01 21:52:13 149 2

原创 8月27日集训

今天考了一天试上午:T1:普通数学题,考的就是细心,需要特判100分和0分的情况不多说了TvT#include<cstdio>#include<algorithm>#include<cstring>#include<string>using namespace std;int N,A,S;int Maxx,Minn;template <typename T>inline void in(T &x) { T

2021-08-27 21:16:55 69

原创 线段树(带修改操作)

#include<cstdio>#define lid (id<<1)#define rid (id<<1|1)using namespace std;struct seg_tree{ int l,r; int lazy,sum;}tr[100005*4];int n,m;int a[100005],ans[100005],v;void build(int id,int l,int r){ tr[id].l=l; tr[id].r=r.

2020-08-03 17:19:25 108

原创 线段树(无修改操作)

#include<cstdio>#include<algorithm> #define lid (id*2)#define rid (id*2+1)using namespace std;struct s_tree{ int l,r; int mx,sum;}tr[100005*4];int a[100005],n,ans[100005],m,v;void build(int id,int l,int r){ tr[id].l=l; tr[id]..

2020-08-03 17:18:37 112

原创 树带权值

#include<bits/stdc++.h> using namespace std;struct edge{ int v,w;}; vector<edge> g[100010];int vis[100010],n,m,d,sum=0,summ[11];int o=-1;inline int read(){ int f=1,x=0;char ch;...

2019-03-30 10:29:28 751

原创 并查集

#include<bits/stdc++.h>using namespace std;int pre[1000005];int find(int x) //路径压缩 1{ int r=x; while(pre[r]!=r) { r=pre[r]; } /*int i=x,j; while(i!=r) { j=pre[i]; pre[i]=...

2019-03-30 10:28:43 106

原创 树求重心

#include<cstdio>#include<vector>using namespace std;int n,vis[10000],size[10000],mx[10000];vector<int> g[10000];int minn=10000;void addegde(int u,int v){ g[u].push_back(v...

2019-03-30 10:28:08 128

原创 树求直径

#include<cstdio>#include<cstring>#include<vector>using namespace std;int n,vis[10000],size[10000],dis[10000];struct egde{ int v,w;};vector<egde> g[10000];int maxx=0...

2019-03-30 10:27:36 185

原创 堆排序

#include<bits/stdc++.h>using namespace std;int h[10000];int n; void swap(int x,int y){ int c; c=h[x]; h[x]=h[y]; h[y]=c;}void up(int i){ if(i==1) return; while(h[i]<h[i/2] ...

2019-03-30 10:26:27 95

原创 C++快速读取

快速读取简称快读,废话不多说,直接上代码。int read(){ int x=0,f=1; char ch; do{ ch=getchar(); if(ch=='-') f=-1; }while(ch&gt;'9'||ch&lt;'0'); do{ x=x*10+ch-'0'; ch=getchar(); }while(ch&lt;='9'&amp;&amp;...

2019-01-26 14:24:48 1213 1

原创 删数问题

经典贪心算法:每次删去下降序列的第一个举个栗子:175438       下降序列为:7 5 4 3所以删去715438         下降序列为:5 4 3所以删去51438           下降序列为:4 3所以删去4138             无下降序列则删去最后一个代码如下:#include&lt;cstdio&gt;#in...

2018-11-03 10:03:02 310

原创 C++ 快速排序

以前都用sort,现在自己写了一个直接上代码#include&lt;cstdio&gt;#include&lt;iostream&gt;using namespace std;int n,a[100000]={0};void qsort(int i,int j){ int l=i,r=j,t=a[i]; if(i&gt;j) return ; while(i!=j)...

2018-10-27 10:01:14 491

原创 C++ 高精度乘法

才发现上次写的高精乘是错的,所以我就再写了一个#include&lt;cstdio&gt;#include&lt;cstring&gt;#include&lt;algorithm&gt;using namespace std;char a[100],b[100];int n1=0,n2=0,n,sa[100],sb[100],c[10000],f[100000]={0},nn1=...

2018-10-12 16:56:02 1016 1

原创 DP-走楼梯

有N级楼梯,一次可走1或2级,问有几种走法?N&lt;=5000分析:走到P级的走法=走到P-1的走法数+走到P-2的走法数所以为动规。#include&lt;cstdio&gt;#define INF 1000000int dp[INF]={0},n;int main(){ scanf("%d",&amp;n); dp[0]=1;//初始化第一个 for(i...

2018-09-22 21:35:01 196

原创 确认进制

【题目描述】6*9=42对于十进制来说是错误的,但是对于13进制来说是正确的。即, 6(13)* 9(13)= 42(13), 而 42(13)=4*131+2*130=54(10)。你的任务是写一段程序,读入三个整数p、q和 r,然后确定一个进制 B(2≤B≤40) 使得 p * q = r。 如果 B 有很多选择, 输出最小的一个。例如:p=11, q=11, r=121.则有11...

2018-09-15 15:42:31 1358 3

原创 洛谷P1031 均分纸牌

经典贪心题思路:每项减去每项的平均数,凡是不为0的,将剩余(不为0)的部分加到下一项,次数加一#include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;algorithm&gt;using namespace std;int n,b[5000],k,c,l=0,mm=0;string a[5000];int mai...

2018-08-25 18:40:28 189

原创 洛谷P1059 明明的随机数

基本思想:先整体快排再去除重复程序:#include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;algorithm&gt;using namespace std;int n,a[200000]={0},z=0,b[200000]={0},k=0,c[200000]={0},q=0;int main(){ cin&gt...

2018-08-25 18:14:19 260

原创 C++数塔递推求最大

#include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;cstring&gt;#include&lt;cmath&gt;#include&lt;algorithm&gt;using namespace std;int main(){ int a[10][10]={0},n; scanf("%d",&amp;n); fo..

2018-07-21 15:52:01 341

原创 C++计算单词个数

一个长度为N的字符串,求其中单词个数。输入1:hello liyang输出1:2输入2:we       are     heros输出2: 3分析:去掉其中多余的空格,并计算空格个数,即单词数为其个数+1#include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;cstring&gt;#i...

2018-07-21 14:31:10 6280 2

原创 C++高精度乘法

#include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;cstring&gt;#include&lt;cmath&gt;#include&lt;algorithm&gt;using namespace std;int main(){ int n,m,t,a[100]={0},b[100]={0},c[100]={0}; ...

2018-07-21 14:04:16 734

原创 C++高精度加法

#include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;cstring&gt;#include&lt;cmath&gt;using namespace std;int main(){ string s1,s2; int a[100]={0},b[100]={0},c[100]={0},n,m,j; bool f[100]...

2018-07-21 14:03:16 323

原创 C++字符串处理

将N个以逗号隔开的整数,求和与最大值。输入68,56,13,26输出16368#include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;cstring&gt;#include&lt;cmath&gt;using namespace std;int zh(string s) //转int函数 核心代码{ int n=s.l...

2018-07-14 12:28:07 249

原创 字符串处理

将N个以逗号隔开的整数,求和与最大值。输入68,56,13,26输出16368#include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;cstring&gt;#include&lt;cmath&gt;using namespace std;int zh(string s)  //转int函数   核心代码{ int n=s.length()...

2018-07-14 11:48:28 172

0x05 排序.ppt

0x05 排序

2021-09-15

树状数组.cpp

树状数组

2021-09-15

RMQ.cpp

RMQ

2021-09-15

0x04 二分.ppt

0x04 二分

2021-09-15

0x13链表与 邻接表.pptx

0x13链表与 邻接表

2021-09-15

树的直径与最近公共祖先.pptx

树的直径与最近公共祖先

2021-09-15

分块.cpp

分块

2021-09-15

状态压缩DP例题.md

状态压缩DP例题

2021-09-15

最小生成树.cpp

最小生成树

2021-09-15

sudoku2.cpp

sudoku2

2021-09-15

0x12 队列.pptx

0x12 队列

2021-09-15

0X11 栈.pptx

0X11 栈

2021-09-15

0x54 树形DP 10_24_24 .pdf

0x54 树形DP 10_24_24

2021-09-15

实数域上的二分.cpp

实数域上的二分

2021-09-15

离散化.cpp

离散化

2021-09-15

树链剖分大杂烩.cpp

树链剖分大杂烩

2021-09-15

树链剖分.pptx

树链剖分

2021-09-15

分数规划.pdf

分数规划

2021-09-15

fibonacci.cpp

fibonacci

2021-09-15

二维前缀和.cpp

二维前缀和

2021-09-15

set的用法.cpp

set的用法

2021-09-15

Tree_LCA---倍增.cpp

Tree_LCA---倍增

2021-09-15

割点.cpp

割点

2021-09-15

整数集合上的二分.cpp

整数集合上的二分

2021-09-15

对顶栈.cpp

对顶栈

2021-09-15

数学基础选讲(1).pdf

数学基础选讲(1)

2021-09-15

string.cpp

string

2021-09-15

割边.cpp

割边

2021-09-15

石子合并.cpp

石子合并

2021-09-15

简单数论.ppt

简单数论

2021-09-15

bsgs.cpp

bsgs

2021-09-15

分解质因数.cpp

分解质因数

2021-09-15

快速幂本幂+乘法防溢出.cpp

快速幂本幂+乘法防溢出

2021-09-15

IDAstar.pdf

IDAstar

2021-09-15

0x01位运算.pptx

0x01位运算

2021-09-15

堆.cpp

2021-09-15

IDA_star.cpp

IDA_star

2021-09-15

kmp.cpp

kmp

2021-09-15

getdline.cpp

getdline

2021-09-15

线性筛约数个数.cpp

线性筛约数个数

2021-09-15

空空如也

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

TA关注的人

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