![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构学习
飞翔的企鹅h
这个作者很懒,什么都没留下…
展开
-
草稿算法 蓝桥杯练习set数组以及二分法简单写法
学习草稿#include <iostream> #include <algorithm> #include <set> #define N 100001 using namespace std; int main() { set<int> arr; int n,data; cin >> n; for(int i = 0;i < n;i++) { cin >> data; if(arr.upper_bound(data)!=arr原创 2022-03-12 17:25:49 · 181 阅读 · 0 评论 -
万能头文件#include<bits/stdc++.h>
#include<bits/stdc++.h>包含了目前c++所包含的所有头文件.https://www.cnblogs.com/Kiven5197/p/5745589.html原创 2021-12-12 20:16:50 · 561 阅读 · 0 评论 -
排序学习1-快速排序
在acwing找的算法,优化了空间复杂度,包容性更强,比赛适合使用,而且好记。void QuickSort(int a[], int low, int high){ if(low>=high) return; int i=low-1;//扩 int j=high+1; int x=a[low+high>>1];//x取数组最中间的值,对比其他快排更优化内存,其他的快排是取第一个 while (i<j){ do i++; whi原创 2021-12-09 00:09:48 · 497 阅读 · 0 评论 -
字符串算法练习3 质数判断
质数判断bool Isprime(int x)//一个判断素数的函数{ if(x==1||x==0) return false; else if(x==2) return true;//这里把0,1,2给特判一下 else { for(int i=2;i<=sqrt(x);i++) { if(x%i==0) return false; } return true; }}数字母判断是原创 2021-11-11 18:19:45 · 400 阅读 · 0 评论 -
字符串算法学习1getchar判断字符串输入
#include <iostream>#include <cstdio>using namespace std;int main(){ char s; int n=0; **while((s=getchar())!= EOF)**//判空 { if(s != ' '&&s != '\n')//不计空格和换行计算字符个数 n++; } cout << n &原创 2021-11-11 18:02:39 · 308 阅读 · 0 评论 -
字符串算法练习2 口算练习题 求字符长度
题目描述王老师正在教简单算术运算。细心的王老师收集了i道学生经常做错的口算题,并且想整理编写成一份练习。 编排这些题目是一件繁琐的事情,为此他想用计算机程序来提高工作效率。王老师希望尽量减少输入的工作量,比如5+8的算式最好只要输入5和8,输出的结果要尽量详细以方便后期排版的使用,比如对于上述输入进行处理后输出 5+8=13 以及该算式的总长度6。王老师把这个光荣的任务交给你,请你帮他编程实现以上功能。输入输出格式输入格式:第一行为数值i接着的i行为需要输入的算式,每行可能有三个数据或两个数据。原创 2021-11-11 18:16:26 · 260 阅读 · 0 评论 -
分治算法学习1 ti优化输入输出和abs绝对值计算
题目:铺设油井管道代码:参考https://blog.csdn.net/qq_49222080/article/details/120661336#include <iostream>#include <algorithm>#include <cmath>#include <string>#include <iomanip>#define ll long long#define N 100000const int maxn=原创 2021-11-14 17:16:32 · 669 阅读 · 0 评论 -
数据结构二叉树学习1-前序序列创建二叉树
先序插入二叉树,中序输出二叉树原创 2021-12-05 01:09:43 · 376 阅读 · 0 评论