搜索结果
查询Tags标签: typedef,共有 149条记录-
线性表的一些基本操作
线性表的基本操作 顺序表的实现 1.静态分配 #define Maxsize 10//最大容量 typedef struct{ ElemType data[Maxsize]; int length;//当前长度 }SeqList; 2.动态分配 #define InitSize 10//顺序表的初始长度 typedef struct{ ElemType *data;//定义一个指针指向顺序表的第一…
2022/6/12 23:50:14 人评论 次浏览 -
C语言快速排序
#include<stdio.h> #define MAXSIZE 100 typedef int KeyType; typedef struct {KeyType key; }RecordType; typedef struct {RecordType r[MAXSIZE+1];int length; }RecordList; RecordList L; int QKpass(RecordList *L,int low,int high) {int pivot;//枢轴为第一…
2022/6/9 23:50:14 人评论 次浏览 -
“山大地纬杯”第十二届山东省ICPC大学生程序设计竞赛部分个人题解
A - Seventeen 显然\(n=1,2,3\)时无解,先手算出\(n=4,5,6,7\)时的解,然后根据\(s[i]=s[i-4]+(i-3)+i-(i-2)-(i-1)\)递推即可code #include<bits/stdc++.h> using namespace std; typedef double db; const int N=50+10; string s[N]; int n; string i2s(int x) {s…
2022/5/26 1:51:16 人评论 次浏览 -
B. A Perfectly Balanced String?
题目链接 B. A Perfectly Balanced String? 给出一个字符串 \(s\) ,对于 \(s\) 中出现过的任意两个字母 \(u, v\) ,定义一个 Balanced 的字符串满足在任何 一个子串中 \(u\) 和 \(v\) 的出现次数相差不超过 1 . 判断字符串是否满足 Balanced 条件. 解题思路思维满足条件…
2022/5/1 23:18:31 人评论 次浏览 -
2022.4.26
AtCoder Beginner Contest 249 A - Jogging 没读好,题面有点问题20分钟后才了改题面。 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using namespace std; typedef long long ll; typede…
2022/4/26 6:14:28 人评论 次浏览 -
先序输出叶结点
先序输出叶结点 本题要求按照先序遍历顺序输出给定二叉树的叶节点 函数接口定义 void PreorderPrintLeaves( BinTree BT );其中BinTree结构定义如下: typedef struct TNode *Position; typedef Position BinTree; struct TNode{ElementType Data;BinTree Left;BinTree Ri…
2022/4/22 23:17:06 人评论 次浏览 -
2022.4.15
AtCoder Beginner Contest 236 A - chukodai #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using namespace std; typedef long long ll; typedef pair<int,int> pii; const int N=1…
2022/4/15 23:42:59 人评论 次浏览 -
寒假 杂题题解
寒假 杂题题解 大根堆 题意 从一棵树上选出尽可能多的点,满足大根堆性质 即对于 \(i,j\) 若 \(j\) 是 \(i\) 是 \(j\) 的祖先,则 \(v_i>v_j\),\(v\) 为点权 这些点不必形成这棵树的一个连通子树。\(n\le2\times10^5\) sol 由于点不需要相邻,这题其实是树上 LIS , …
2022/4/12 23:14:32 人评论 次浏览 -
D. A Simple Task
题目链接 D. A Simple Task 给定 \(n\) 个点 \(m\) 条边的简单图,计算图中有多少个简单环 数据范围 \(1 ≤ n ≤ 19, 0 ≤ m\) 解题思路状压dp状态表示:\(f[i][j]\) 表示状态为 \(i\) 时,起点为 \(i\) 的最低位,终点为 \(j\) 时的最少环数状态计算:\(f[i|1<…
2022/4/4 23:19:30 人评论 次浏览 -
2022.4.2
AtCoder Beginner Contest 246 贴个代码,明早补 A - Four Points #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using namespace std; typedef long long ll; typedef pair<int,int>…
2022/4/3 6:21:31 人评论 次浏览 -
2022.3.28
Codeforces Round #779 (Div. 2) A. Marin and Photoshoot 把所有0的位置找出来放到数组里,如果相邻的0距离为1的话,说明要往中间插2个1,如果距离为2的话只需要插1个1。 #include<iostream> #include<cstdio> #include<algorithm> #include<cstri…
2022/3/28 6:22:40 人评论 次浏览 -
Libreoj 6279. 数列分块入门 3
1 #include<bits/stdc++.h>2 using namespace std;3 typedef long long ll;4 const int N=1e5+5;5 vector<ll>v[N];6 ll a[N],tag[N],blg[N],L[N],R[N],block,tot;7 void resort(int n)8 {9 v[n].clear(); 10 for(int i=L[n];i<=R[n];i++)v[n].pus…
2022/3/8 23:19:16 人评论 次浏览 -
2021蓝桥杯省赛B组(C/C++)E.路径【最短路DP】
2021蓝桥杯省赛B组题目(C/C++)E.路径 最短路径, 因为变化情况比较多, 所以开始想的是深搜, 但是太慢了, 跑不出来, 后来就想着优化一下, 有的地方到另一个地方可能会考虑很多遍, 于是考虑了DP#include <bits/stdc++.h>using namespace std;typedef long long LL; …
2022/3/8 22:44:39 人评论 次浏览 -
嘉明的C学习之Day14--typedef的使用、C++引用
typedef的使用 在我们使用结构体的时候比如:struct student s要打一大串字符,感觉特别的繁琐。那么 typedef其实主要作用就是起别名,方便我们使用变量和看懂程序 #include<stdio.h> //定义结构体的别名 typedef struct student {int num;char name[20];char sex;…
2022/3/2 14:16:35 人评论 次浏览 -
redis原source学习-dict
源代码连接: https://github.com/redis/redis/blob/unstable/src/dict.h https://github.com/redis/redis/blob/unstable/src/dict.c dict.h:类dict(字典<哈希>) Function Set:dict->typedict.c: 调用例子入口:dictTest 函数指针: 可不需要#typedef进行…
2022/2/27 19:51:26 人评论 次浏览