自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(56)
  • 资源 (1)
  • 收藏
  • 关注

原创 HJ3 明明的随机数

题目思路:定义一个长度为510的数组来表示输入的每个数字是否出现过。数组的值为1,表示已出现。数组的值为0,表示未出现。遍历数组,依次判断即可。

2023-08-17 21:11:01 176

原创 HJ2 计算某字符出现次数

【代码】HJ2 计算某字符出现次数。

2023-08-17 20:46:46 141

原创 HJ1 字符串最后一个单词的长度

【代码】HJ1 字符串最后一个单词的长度。

2023-08-17 20:26:05 134

原创 华为机试:牛客网 HJ7 取近似值

【代码】华为机试:牛客网 HJ7 取近似值。

2023-08-16 20:55:47 83

原创 简述 C++ vector 的用法

动态数组:主要有 vector的初始化、插入、访问、大小和容量和deque的插入和删除#include<vector>using namespace std;int main(){ // 一 初始化 // 初始指定长度 为10 vector<int> a (10); // 初始为 10 个 5 vector<int> b ( 10, 5); // 复制 vector<int> c (b); // 指定范围的 复制

2021-04-08 22:53:36 83

原创 简述C++ string的用法

7个部分初始化、访问、拼接、查找、截短、反转、大小写转换#include<string>#include<iostream>using namespace std;int main(){ const char* a = "Hello World!";// 常量字符串 cout << a << endl; // 一 //sting的初始化 //复制 string b (a); // string b = a; cout &l

2021-04-08 09:40:20 118

原创 C/C++ 学生信息管理系统

#include<iostream>#include<string.h> #include<stdlib.h>using namespace std;// 学生信息结构体 STU 的定义 typedef struct { char name[10]; // 姓名 char num[20]; // 学号 char class_[10]; // 班级 double score[3]; // 3门学科成绩(离散数学、英语、微积分) }STU;c

2020-11-12 15:41:40 119

原创 顺序栈的基本操作

//constant.h#define OK 1#define ERROR 0#define OVERFLOW -2#define TURE 1#define FALSE 0 typedef int Status;//SqStack.h#define STACK_INIT_SIZE 10#define STACK_INCREMENT 5struct SqStack{ SElemType *base; SElemType *top; int stacksize;};//顺序栈

2020-10-15 20:28:50 124

原创 单链表的基本操作

//LinkList.htypedef int ElemType;typedef struct LNode{ ElemType data; struct LNode *next;}LNode, *LinkList;//LinkList_Operation.cppusing namespace std;// 1 单链表的初始化 Status InitList(LinkList &L){ L = new LNode; L->next == NULL; return OK;

2020-10-14 20:41:59 78

原创 线性表操作

//SqList.h#define MAXSIZE 100typedef int ElemType;typedef struct{ ElemType *elem;//存储空间的基地址 int length;//当前长度 }SqList;//顺序表SqList //SqList_Operation.cpp// 1 InitList 构建空表Status InitList(SqList &L){ L.elem = new ElemType[MAXSIZE];//为线性表动态分配一个

2020-10-12 20:27:12 72

原创 小楼昨夜又东风

2020/10/11今日退役,暂时冷静下来,多思考,多努力,回头定再来。

2020-10-11 19:27:31 112

原创 C++ priority_queue 基本操作

#include<queue>using namespace std;int main(){ priority_queue <int> a; priority_queue <double> b; priority_queue < int, vector <int>, greater <int> > c; priority_queue <int> d( a);} #include<queue>

2020-09-28 08:16:11 94

原创 C++ queue 基本操作

#include<queue>#include<list>using namespace std;int main(){ queue <int> a; queue <double> b; queue <double, list <double> > c;//use list queue <int> d( a);} #include<queue>#include<iostream&gt

2020-09-28 08:15:23 192

原创 C++ stack 基本操作

#include<stack>#include<vector>using namespace std;int main(){ stack <int> a; stack <double> b; stack <int, vector <int> > c; // 选用vector stack <int> d( a);}#include<stack>#include<iostream&gt

2020-09-28 08:13:41 253

原创 C++ lower_bound upper_bound

#include<vector>#include<iostream>#include<algorithm>using namespace std;void show( const vector <string> a){ for(auto p = a.begin(); p != a.end(); p ++) cout << *p << endl; cout << endl;}int main(){ ve

2020-09-26 12:19:21 131

原创 C++ partition stable_partition

#include<vector>#include<algorithm>#include<iostream>using namespace std;void show( const vector <int> a){ for(auto p = a.begin(); p != a.end(); p ++) cout << *p << ' '; cout << endl;}int main(){ vecto

2020-09-26 12:18:17 103

原创 C++ binary_search unique

#include<vector>#include<string>#include<iostream>#include<algorithm>using namespace std;void show( const vector <string> a){ for(auto p = a.begin(); p != a.end(); p ++) cout << *p << endl; cout <<

2020-09-26 12:17:19 113

原创 C++ replace replace_if

#include<vector>#include<iostream>#include<algorithm>using namespace std;void show( vector <int> &a){ for(auto p = a.begin(); p != a.end(); p ++) cout << *p << ' '; cout << endl;}int main(){ vector

2020-09-26 12:16:12 135

原创 C++ copy_backward

#include<vector>#include<iostream>#include<algorithm>using namespace std;int main(){ vector <int> a{ 1, 2, 3, 4, 5}, b(5); //copy_backward( iterator first, iterator last, iterator) 沿反方向复制 返回一个指向复制结束位置的的迭代器 auto i = copy_b

2020-09-26 09:54:13 159

原创 C++ copy copy_if remove remove_if

#include<vector>#include<list>#include<iostream>#include<algorithm>using namespace std;void show( const vector<int> &a){ for(auto p = a.begin(); p != a.end(); p ++) cout << *p << ' '; cout << en

2020-09-26 09:53:34 96

原创 C++ transform

#include<string>#include<vector>#include<deque>#include<algorithm>#include<iostream>#include<functional>using namespace std;template <typename T>void show(const T& a){ for(auto p = a.begin(); p != a.e

2020-09-26 09:52:15 121

原创 C++ for_each

#include<vector>#include<string>#include<iostream>#include<algorithm>using namespace std;struct show{ int count; show (): count(0){} void operator()(const char& c){ cout << c; count ++; }};int main(){ vec

2020-09-26 09:51:11 69

原创 C++ generate generate_n

#include<vector>#include<list>#include<iostream>#include<algorithm>using namespace std;template <typename T>void show( const T& a){ for(auto p = a.begin(); p != a.end(); p ++) cout << *p << ' '; cout

2020-09-26 09:50:07 322

原创 C++ fill fill_n

#include<algorithm>#include<vector>#include<iostream>using namespace std;int main(){ vector <int> a(10); //fill( iterator first, iterator last, key) fill( a.begin(), a.end(), 1); a.resize(15); //fill_n( iterator first, n

2020-09-25 17:22:34 81

原创 C++ search search_n

#include<vector>#include<iostream>#include<list>#include<algorithm>using namespace std;int main(){ vector <int> a; for(int i = 0; i < 10; i ++) a.push_back( i); a.push_back( 9); a.push_back( 9); for(auto i =

2020-09-25 17:21:58 306

原创 C++ count count_if

#include<vector>#include<iostream>#include<algorithm>using namespace std;int main(){ vector <int> a; a.push_back( 1); a.push_back( 1); a.push_back( 2); a.push_back( 2); a.push_back( 3); a.push_back( 3); int count1, co

2020-09-25 17:21:20 102

原创 C++ find find_if

#include<vector>#include<algorithm>#include<iostream>using namespace std;int main(){ vector <int> a{ 1, 2, 3, 4, 5}; int x; cout << "put in the value you want to search" << endl << '>'; cin >> x

2020-09-25 17:20:42 237

原创 C++ lambda表达式的通用格式

#include<bits/stdc++.h>using namespace std;int main(){ //在此总结一下lambda表达式的通用格式 //[ State(&引用__无&时 状态变量为只读模式,不可在表达式内修改) 1, State(&) 2, ...] //( elemtype(&引用) 1, elemtype(&) 2, ...] //(mutable)__用于在表达式内修改状态变量且修改只在表达式内有效 __当状态变

2020-09-25 12:22:18 349

原创 C++ 二元谓词对应的lambda表达式

#include<vector>#include<string>#include<algorithm>#include<iostream>using namespace std;template <typename T>void show( const T& a){ for(auto p = a.begin(); p != a.end(); p ++) cout << *p << endl;

2020-09-25 12:21:21 247

原创 C++ 二元函数对应的lambda表达式

#include<algorithm>#include<vector>#include<iostream>using namespace std;int main(){ vector <int> a{ 1, 2, 3, 4, 5}, b( a), c( a.size()); //二元函数对应的lambda表达式 transform( a.begin(), a.end(), b.begin(), c.begin(),[](int a, int

2020-09-25 12:20:28 350

原创 C++ 接受状态变量的lambda表达式

#include<algorithm>#include<vector>#include<iostream>using namespace std;int main(){ vector <int> a{ 1, 3, 5, 7, 9, 11}; int x; cout << "input 除数 x" << endl << '>'; cin >> x; //通过捕获列表[...]接受状

2020-09-25 12:19:50 333

原创 C++ 一元谓词对应的lambda表达式

#include<vector>#include<algorithm>#include<iostream>using namespace std;int main(){ vector <int> a{ 1, 3, 5, 7, 9, 11}; //一元谓词对应的lambda表达式 -- a > 7 是 return ture auto p = find_if( a.begin(), a.end(), [](int& a){

2020-09-25 12:17:11 309

原创 C++ 一元函数对应的 lambda表达式

#include<algorithm>#include<vector>#include<list>#include<iostream>using namespace std;int main(){ vector <int> a{ 1, 2, 3, 4, 5}; // 一元函数对应的 lambda表达式 for_each( a.begin(), a.end(), [](int& a){ cout <<

2020-09-25 12:16:08 201

原创 C++ 一元函数 一元谓词 二元函数 二元谓词

21C++ 的 21章#include<algorithm>#include<vector>#include<list>#include<iostream>using namespace std;template <typename T>struct show{ void operator() (const T& a) const{ cout << a << ' '; }};int mai

2020-09-24 20:55:45 389

原创 STL map multimap 一些基本操作

21C++ STL map 一些基本操作#include<map>#include<string>using namespace std;int main(){ map <int, string> a1; multimap <int, string> a2; map <int, string> b1( a1); multimap <int, string> b2( a2); map <int, stri

2020-09-23 17:09:27 93

原创 21C++ STL set multiset 一些基本操作

一些基本操作#include<set>using namespace std;int main(){ set <int> a{ 1, 2, 3, 4}; multiset <int> b; set <int> c( a); multiset <int> d( a.begin(), a.end());//两个描述边界的迭代器 }#include<set>#include<iostream>us

2020-09-22 19:38:19 101

原创 21C++ STL list 基本操作

一些基本操作#include<list>#include<vector>using namespace std;int main(){ list <int> a;//空链表 list <int> b(10);//10个元素 list <int> c( 10, 90);// 10 个 90 vector <int> d( 5, 9); list <int> e( d.cbegin()

2020-09-21 22:25:59 71

原创 21C++ STL forward_list 单向链表

一些基本操作#include<iostream>using namespace std;template <typename T>void show(const T& a){ for(auto i = a.begin(); i != a.end(); i ++) cout << *i << ' '; cout << endl;}int main(){ forward_list <int> a; //单向

2020-09-21 22:25:38 110

原创 反片语 UVA 156

输入一些单词,找出所有满足如下条件的单词:该单词不能通过字母重排,得到输入文本中的另外一个单词。 在判断是否满足条件时,字母不分大小写,但在输出时应保留输入中的大小写,按字典序进行排列(所有大写字母在所有小写字母的前面)。Sample Inputladder came tape soon leader acme RIDE lone Dreis peatScAlE orb eye Rides dealer NotE derail LaCeS drIednoel dire Disk mace Rob d

2020-09-21 08:42:05 174

原创 21C++ STL vector 练习题

17章作业#include<vector>#include<algorithm>#include<iostream>using namespace std;int fun(){ cout << "please select" << endl; cout << "1 to add data" << endl; cout << "2 to find data" << endl; co

2020-09-21 08:16:12 941

真值表、主析取范式、主合取范式

离散数学 编程实现求解逻辑表达式的真值表、主析取范式、主合取范式对于一个含n个命题变元的表达式(n为相异的命题变元总个数),其真值表可看作由从0到2ⁿ-1的二进制数的变化表。因此,可以通过按行列举0到2ⁿ-1的二进制数来模拟真值表中命题变元的值。而对于表达式,在每一行,其值可通过运用该行的命题变元的值来求解。为此,应考虑:

2020-10-25

空空如也

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

TA关注的人

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