自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(37)
  • 收藏
  • 关注

原创 计算机内部储存单位

比特(bit)是计算机内部数据储存的最小单元1B/byte(字节)=8bit1KB(千字节)=1024B1MB(兆)=1024KB1GB(千兆)=1024MB

2022-03-14 20:35:36 116

原创 二叉树建立

#include<bits/stdc++.h>using namespace std;struct bitnode{ int data; bitnode* lchild; bitnode* rchild;};typedef bitnode* bitree;void crtbitree(bitree &t){ int d; cin>>d; if(d==0)t=NULL; else{ t=(bitree)malloc(sizeof(bitree

2021-10-22 09:03:18 76

原创 链式队列10.7

#include<bits/stdc++.h>using namespace std;//普通节点创建 struct Qnode{ int data; Qnode* next;};typedef Qnode* Queueptr;//队列创建struct linkQueue{ Queueptr rear,front; };//初始化void initial(linkQueue &Q){ Q.front=(Qnode*)malloc(sizeof (Q

2021-10-08 09:37:14 83

原创 先改动 后验证

#include<bits/stdc++.h>using namespace std;typedef long long ll;int main(){ ll n; cin>>n; getchar(); string s[100001]; for(int i=1;i<=n;i++) { cin>>s[i]; ll l=s[i].size(); for(int j = 0; j < l; j++) { if(

2021-10-03 06:44:22 45

原创 Figure Skating map与pair

#include<bits/stdc++.h>using namespace std;typedef pair<int,int> pr;map<string ,pr>mp;int main(){ int n; cin>>n; string s,ss[10010]; getchar(); for(int i=1;i<=n;i++) { getline(cin,s); ss[i]=s; mp[s].first=i; }

2021-10-02 21:47:40 101

原创 链表建立 输出

#include<bits/stdc++.h>using namespace std;struct lnode{int data;lnode* next;//节点类型};//建立链表void gett(lnode* &l,int len){//生成带头节点的空链表l=(lnode*)/强制转化类型为lnode*/malloc(sizeof(lnode)); //起始位置的地址l->next=NULL;lnode* ptail;ptail=l;//生成节点

2021-09-24 09:37:51 80

原创 2021-09-23

C . Spell Checker [ 问题 7976 ] [ 讨论 ]DescriptionThis question is about automatic spelling correction. Studies have shown that the majority of typing errors are caused by (let’s assume the dictionary contains the word “these”):Omitting one letter, e.g.,

2021-09-23 20:45:31 107

原创 Pawn’s Revenge

#include<bits/stdc++.h>using namespace std;typedef long long ll;//-1 的情况 //*只能被下面的两个“—”消灭 int dy[8]={-1,-1,-1,1,1,1,0,0};int dx[8]={-1,1,0,1,-1,0,1,-1};ll a[1001][1001];char s[1001][1001];ll num,cnt;int main(){ ll n,f=1,jj,ji; cin>&gt

2021-09-20 21:38:44 155

原创 Balanced Strings emo

#include<bits/stdc++.h>using namespace std;typedef long long ll;int is(char c) { if(c=='i'||c=='o'||c=='a'||c=='u'||c=='e'||c=='y') return 1; else return 0;}int main(){ string s; ll l,sum=1,cnt=0,g=0,ji,f=1; cin>>s; l=s.size();

2021-09-20 20:20:58 308

原创 vector

#include<bits/stdc++.h>using namespace std;int main(){ //vector的创建 vector<int>a(3); vector<int>b; for(int i=0;i<3;i++)b.push_back(i); vector<int>c(b.begin(),b.begin()+2); int o[10]={1,2,3}; vector<int>d(o,o+3);

2021-09-18 22:05:18 44

原创 kmp9.18

#include<bits/stdc++.h>using namespace std;int nex[1001];//nex[i]=j: 下标为i的字符前最长相等的前后缀是j//j也代表了最长前后缀的值void getnex(int nexx[],string s){ //j是前缀末尾 i是后缀末尾 //a a b a a f //0 1 0 1 2 0 //first step : initial int j=0;nexx[0]=0; for(int i=1;i&lt

2021-09-18 21:08:24 56

原创 2021-09-15

Lemonade Stand [ 问题 8628 ] [ 讨论 ]DescriptionYou are running a lemonade stand and have the good fortune of knowing exactly how many cups of lemonade customers are going to want to buy on each day that you run the lemonade stand. You hate to turn any cust

2021-09-15 21:36:36 142

原创 2021-09-15

E . Rain Gauge [ 问题 8629 ] [ 讨论 ]DescriptionWhen going to your internship you got a nice apartment with a skylight. However, one crazy party later and you now have a square-shaped hole where your skylight used to be. Rather than telling the landlord, y

2021-09-15 21:20:07 82

原创 HDU 半完全数

给出一个p,找到k,k满足①k是p的倍数②k是完全数因为k给出的范围特别大,我们不可能直接暴力找那我们知道一定:k=p*()()里面的数一定是个完全数 比如6 能被分解为 1+2+3那么k不就是p*(1+2+3)那k的三个因子不就是 p1+p2+p*3!...

2021-09-04 19:32:45 139

原创 pair

pair<T1, T2> p1; //创建一个空的pair对象(使用默认构造),它的两个元素分别是T1和T2类型,采用值初始化。pair<T1, T2> p1(v1, v2); //创建一个pair对象,它的两个元素分别是T1和T2类型,其中first成员初始化为v1,second成员初始化为v2。make_pair(v1, v2); // 以v1和v2的值创建一个新的pair对象,其元素类型分别是v1和v2的类型。p1 <

2021-08-30 19:28:43 49

原创 A . 数列分块入门1

A . 数列分块入门1 [ 讨论 ]Description给出一个长为n 的数列,以及 n 个操作,操作涉及区间加法,单点查值。Input第一行输入一个数字n。第二行输入n个数字,第i个数字为ai,以空格隔开。接下来输入n行询问,每行输入四个数字opt,l,r,c,以空格隔开。若opt=0,表示将位于[l,r]的之间的数字都加c。若opt=1,表示询问ar 的值(l和c忽略)。Output对于每次询问,输出一行一个数字表示答案。SamplesInput 复制41 2 2 30

2021-08-17 23:29:45 100

原创 唯一分解定理与组合数

Choose and divideDescriptionThe binomial coefficient C(m,n) is defined asC(m,n)=m!(m−n)!n!Given four natural numbers p,q,r, and s, compute the the result of dividing C(p,q) by C(r,s).InputInput consists of a sequence of lines. Each line contains four

2021-08-15 22:54:15 70

转载 唯一分解定理

唯一分解定理:任何一个大于1的自然数n都可以用某些素数的次方的乘积来表示一,我们要得到素数表,使用欧拉筛ll num[maxn];ll prime[maxn];void getprime(ll n){ ll i,n,j,cou=0; memset(num,0,sizeof num);//全是素数 for(i=2;i*i<=n;i++) { if(!num[i])prime[cou++]=i; for(j=0;j<cou;j++)//用现有的素数去筛 { nu

2021-08-15 18:27:41 200

原创 快速幂 8.6

如果让我们求3的100次方,我们写循环跑100次,res*=3,是非常慢的。如果数再大一点,可能要超时了。但是我们可以分解问题求3的100次方的时候可以先求3的50次方,求3的50次方的时候可以先求3的25次方,求3的25次方的时候可以先求3的12次方,这样计算次数大大减少。但是会有一个问题,在这一步:3的25次方的时候 ->求3的12次方 3^25 = 3 ^12 *3 ^12 *3 ^1 也就是说如果指数是奇数的话 比如25 我们计算的时候别忘记还有一个3的一次方。int

2021-08-06 23:56:56 48

原创 Colossal Fibonacci Numbers!

DescriptionThe i’th Fibonacci number f(i) is recursively defined in the following way:f(0)=0 and f(1)=1f(i+2)=f(i+1)+f(i) for every i≥0Your task is to compute some values of this sequence.InputInput begins with an integer t≤10,000, the number of test

2021-08-06 23:01:39 66

原创 E . Wine Trading in Gergovia

E . Wine Trading in GergoviaDescriptionAs you may know from the comic “Asterix and the Chieftain’s Shield”, Gergovia consists of one street, and every inhabitant of the city is a wine salesman. You wonder how this economy works? Simple enough: everyone b

2021-08-02 21:42:09 57

原创 2021-07-31L . Oil Deposits

DescriptionThe GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides the land into numerous square plots. It then a

2021-07-31 18:56:08 53

原创 G . Trees on the level

G . Trees on the levelDescriptionTrees are fundamental in many branches of computer science (Pun definitely intended). Current stateof- the art parallel computers such as Thinking Machines’ CM-5 are based on fat trees. Quad- and octal-trees are fundament

2021-07-31 14:51:32 50

原创 2021-07-F . Dropping Balls紫书第六章

DescriptionA number of K balls are dropped one by one from the root of a fully binary tree structure FBT. Each time the ball being dropped first visits a non-terminal node. It then keeps moving down, either follows the path of the left subtree, or follows

2021-07-28 11:39:36 57

原创 Broken Keyboard

DescriptionYou’re typing a long text with a broken keyboard. Well it’s not so badly broken. The only problem with the keyboard is that sometimes the “home” key or the “end” key gets automatically pressed (internally).You’re not aware of this issue, since

2021-07-27 23:46:24 57

原创 C . Matrix Chain Multiplication

DescriptionSuppose you have to evaluate an expression like A∗B∗C∗D∗E where A,B,C,D and E are matrices.Since matrix multiplication is associative, the order in which multiplications are performed is arbitrary. However, the number of elementary multiplicat

2021-07-27 21:38:36 86

原创 2021-07-25 Division

#include<bits/stdc++.h>using namespace std;typedef long long ll;ll n,i,j,k,m,t;ll f(ll n,ll m){ ll a[1001]={0},cou=0; while(n) { cou++; a[n%10]++; if(a[n%10]>1) return 0; a[m%10]++; if(a[m%10]>1) return 0; n/=10; m/=10

2021-07-25 22:38:03 34

原创 Tree Recovery

题目:http://202.194.62.52/contest/1824/problem/2题意:给出先序遍历和中序遍历,求后序遍历。先序遍历:根->左树->右树 中序遍历: 左树->根->右树样例解释:input:DBACEGF ABCDEFG //前序遍历是DBACEGF,中序遍历是ABCDEFGoutput:ACBFGED因为前序先遍历根 中序中间是根,可知D是根,所以BAC(ABC)是左大树,EGF(EFG)是右大树。同样的道理,得左大树:B是根,A是

2021-07-24 22:47:33 89 1

原创 2021-07-24 S-trees

题目:http://202.194.62.52/contest/1824/problem/1解释输入输出:输入:3 //给出三层x3 x1 x2 //层的顺序是x3 x1 x2 (x3是最顶层x1在中层x2在最下层)00010011 //给出最底层 字符串s4 //下面给出四组000 //x1 x2 x3 分别为0 0 0 记为①组010 //x1 x2 x3 分别为0 1 0 记为②组111 //同上

2021-07-24 12:33:16 50

原创 2021-07-23

**题目:**http://202.194.62.52/contest/1824/problem/0**题目大意:**括号匹配的问题,在一个字符串中如果左括号和右括号能恰好匹配上,为“yes”,否则是“no”;**解决方法:**建立一个栈stk,如果是( 或者 【 则进栈,如果是)】就看看是否和栈的顶端相匹配。如果匹配,就stk.pop()之后继续,如果不匹配就是break——>“no”;最后要检查栈是否为空,如果为空,说明括号们正好匹配,是“yes”,如果有剩余,输出“no”**代码:`#in

2021-07-23 15:31:10 70

原创 两个超级大的数相加 栈

#include<bits/stdc++.h>using namespace std;typedef long long ll;string a,b;ll l1,l2,i,j,k,l,nn,num;stack<int >stk;int main() { cin>>a>>b; l1=a.size(); l2=b.size(); while(l1||l2) { num=nn; if(l1) { num+=a[l1-1]-'0

2021-07-15 18:20:19 40

原创 to the max 动态规划 最大子序列和的进阶版

题目链接http://47.110.142.74/contest/1581/problem/4DescriptionGiven a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within the whole array. The sum of a rectangle is the s

2021-04-17 22:50:59 47

原创 欧拉筛 优雅的筛筛筛

题目链接http://47.110.142.74/contest/1692/problem/2Description定义函数f(x)为x的所有质因子乘积。例如:f(4)=2,f(6)=6。注意:当x为1时,f(1)为1。输入一个整数n,输出1到n的函数值。Input一个整数n(n≤1e6)Outputn个整数,用空格分开sampleInput1Output1Input5Output1 2 3 2 5题目分析此题必须用到欧拉筛,此文会讲解欧拉筛。即使用了欧拉筛也会超时

2021-03-30 18:12:41 102

原创 家谱 并查集 map

并查集和map题目描述给出充足的父子关系,请你编写程序找到某个人的最早的祖先。输入格式输入由多行组成,首先是一系列有关父子关系的描述,其中每一组父子关系中父亲只有一行,儿子可能有若干行,用 #name 的形式描写一组父子关系中的父亲的名字,用 +name 的形式描写一组父子关系中的儿子的名字;接下来用 ?name 的形式表示要求该人的最早的祖先;最后用单独的一个 $ 表示文件结束。输出格式按照输入文件的要求顺序,求出每一个要找祖先的人的祖先,格式为:本人的名字 ++ 一个空格 ++ 祖先的名字

2021-03-18 18:34:42 113

原创 守望者的逃离 贪心 动态规划

守望者的逃离 动态规划 贪心题目链接https://www.luogu.com.cn/problem/P1095题目描述:恶魔猎手尤迪安野心勃勃,他背叛了暗夜精灵,率领深藏在海底的娜迦族企图叛变。守望者在与尤迪安的交锋中遭遇了围杀,被困在一个荒芜的大岛上。为了杀死守望者,尤迪安开始对这个荒岛施咒,这座岛很快就会沉下去。到那时,岛上的所有人都会遇难。守望者的跑步速度为17m/s17m/s,以这样的速度是无法逃离荒岛的。庆幸的是守望者拥有闪烁法术,可在1s1s内移动60m60m,不过每次使用闪烁法术都

2021-03-18 10:53:55 162

原创 数字三角形 递推

数字三角形题目链接:**http://icpc.upc.edu.cn/problem.php?id=2192题目描述:对于大多数人来说,“我们是这么的正常,因此也就这么的平庸。”而天才总是与众不同的,所以当邪狼问修罗王:“老大,你蹲在那儿一动不动看了有半个小时了,蚂蚁有那么好看吗?”修罗王是这样回答的:“我在思索人生的意义,你看这蚂蚁的面前有无数的道路选择,但它不知道选择哪条路可以到达目标,也不知道哪条路上有更多的食物,更不知道现在选择的道路对它以后的影响……”如图所示,有一个层数为n(n≤100

2021-03-17 21:29:54 242 1

原创 如何求小数点后的第n位??

## 如何求小数点后的第n位?? ** 如何求小数点后的第n位??** 笔者一开始想用循环,先对这个数字一直乘10,直到我们要求的小数点后那一位,之后对其取余即可。编程实现如下: #include<bits/stdc++.h>using namespace std;int main(){ double a,b,n,m,i=10; int j; cin>>a>>b>>n; m=a/b; while(n) { m=m*i; .

2020-11-09 00:19:31 2147 1

空空如也

空空如也

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

TA关注的人

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