随笔分类 -  cpp基础知识补充(海底捞知识)

做题或者看书时看到一些知识就记录下来吧!海底捞虽说不易,但是捞了比不捞好.并且要及时复习啊!
摘要:默认目录改成main了,而我是按照之前的教程弄的(master) 所以现在要把库传到main咯 底下这个是将这个项目传到master git init git add README.md git commit -m "first commit" git remote add origin https 阅读全文
posted @ 2021-10-26 21:20 安之若醇 阅读(238) 评论(0) 推荐(0) 编辑
摘要:刚刚做题发现不太会四舍五入,,, floor | 不大于自变量的最大整数|3|3|-2|-3| ceil| 不小于自变量的最大整数|4|4|-1|-2| round| 四舍五入到最邻近的整数|3|4|-1|-3 阅读全文
posted @ 2021-04-11 11:16 安之若醇 阅读(146) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> #include<sstream> //istringstream 必须包含这个头文件 #include<string> using namespace std; int main() { string str="i am a boy"; istringstre 阅读全文
posted @ 2021-04-05 19:31 安之若醇 阅读(390) 评论(0) 推荐(0) 编辑
摘要:https://leetcode-cn.com/problems/next-greater-element-ii/submissions/ class Solution { public: vector<int> nextGreaterElements(vector<int>& nums) { in 阅读全文
posted @ 2021-03-06 09:44 安之若醇 阅读(40) 评论(0) 推荐(0) 编辑
摘要:头文件: #include<numeric> 求和 int sum = accumulate(vec.begin() , vec.end() , 0); 注意第三个值是累加地初始值 连接成字符串 string sum = accumulate(v.begin() , v.end() , string 阅读全文
posted @ 2021-03-02 11:03 安之若醇 阅读(86) 评论(0) 推荐(0) 编辑
摘要:众所周知Cnm=n!m!(mn)!,特别地,定义 0!=1 例题在这里:传送门 level 0 一开始的思路必然是挨个算组合数,但是那样必然会超时 level 1 组合数递推法: Cnm=Cnnm 故: \(C_n^m=C_{n-1}^{m- 阅读全文
posted @ 2021-02-18 17:50 安之若醇 阅读(294) 评论(0) 推荐(0) 编辑
摘要:要不是为了写下一篇博客,谁会递归到这里呢 行内公式: \Cn2=1)\(Cn2=1 行间公式 Cn2=1 效果: Cn2=1 i=0Nabg(t,i)dt 来几张图片: 参考博客:https:/ 阅读全文
posted @ 2021-02-18 16:54 安之若醇 阅读(46) 评论(0) 推荐(0) 编辑
摘要:leetcode打卡 题面 class Solution { public: bool checkPossibility(vector<int> &nums) { int n = nums.size(); for (int i = 0; i < n - 1; ++i) { int x = nums[ 阅读全文
posted @ 2021-02-07 09:01 安之若醇 阅读(190) 评论(0) 推荐(0) 编辑
摘要:vector中push_back的平替, 没啥可说的,就是emplace不需要重新建对象 如果对象的构造函数有三个参数的话 那就直接写v.emplace(1,2,3)就可以了 push_back得先把这三个构造一个对象 阅读全文
posted @ 2021-01-31 10:26 安之若醇 阅读(688) 评论(0) 推荐(0) 编辑
摘要:markdown都不会用了 时隔两个月,本来想用一篇基础知识开启假期的局,没想到先复习了markdown语法(我真是太难了) 看一下Ox3f3f3f3f 用来表示正无穷大(-Ox3f3f3f3f是负无穷大) 常用于memset赋初始值的时候用 原理: 我们在程序设计中经常需要使用 memset(a, 阅读全文
posted @ 2021-01-25 08:48 安之若醇 阅读(206) 评论(0) 推荐(0) 编辑
摘要:字体 ~~这是删除线~~ **加粗** *斜体* 这是删除线 加粗 斜体 注意上面几个都是没有空格的 无序列表: * first * second * third first second third 1. first 2. second 3. third(就算你这里写的8. 显示也是3.) fir 阅读全文
posted @ 2021-01-25 08:44 安之若醇 阅读(37) 评论(0) 推荐(0) 编辑
摘要:去重函数,去掉相邻元素中一样的 其实是把后面不重复的移动到前面来!!!!!!!! 需要配合sort使用, 但是要注意它并没有把元素删除,而是把那个元素放到了最后 #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> 阅读全文
posted @ 2020-11-07 12:10 安之若醇 阅读(146) 评论(0) 推荐(0) 编辑
摘要:最近忙考试,,,有亿点点累哦,这边也没咋更.不过,我回来啦 代码能力又下降了不少(小白落泪) 今天才知道,如果 在string 后添加一个字符可以用str+="c" 但是去掉一个字符就不行 那怎么去 //方法:使用erase() str.erase(str.end() - 1); cout << s 阅读全文
posted @ 2020-08-30 10:40 安之若醇 阅读(1055) 评论(0) 推荐(0) 编辑
摘要:看如下代码:(三个一维) 1 #include <iostream> 2 #include <string> 3 #include <string.h> 4 #include <vector> 5 #include <time.h> 6 using namespace std; 7 long MAX 阅读全文
posted @ 2020-07-25 14:57 安之若醇 阅读(620) 评论(0) 推荐(0) 编辑
摘要:这个,输出为1 这个,啥都输不出来. 据说是因为没有初始化. 其实我搜了一下 1 vector<vector<int> > A;//正确的定义方式 2 vector<vector<int>> A;//c++11之前这样定义是错误的,c++11之后支持这种定义方式 因为>>会被认为是右移运算符 但是c 阅读全文
posted @ 2020-07-25 12:09 安之若醇 阅读(958) 评论(0) 推荐(0) 编辑
摘要:1 int read(){ 2 int x=0,f=1; 3 char ch=getchar(); 4 while(ch<'0'||ch>'9'){ 5 if(ch=='-') 6 f=-1; 7 ch=getchar(); 8 } 9 while(ch>='0'&&ch<='9'){ 10 x=( 阅读全文
posted @ 2020-07-12 11:30 安之若醇 阅读(260) 评论(0) 推荐(0) 编辑
摘要:如何在输入输出上提高一下效率emmmm 1 #include<iostream> 2 #include<stdio.h> 3 #include<stdlib.h> 4 #include<time.h> 5 using namespace std; 6 7 int main(){ 8 int star 阅读全文
posted @ 2020-07-12 11:18 安之若醇 阅读(782) 评论(0) 推荐(3) 编辑
摘要:故事的起因:好久没有用bubble了,,,居然忘记了基本格式........ 经过:,,,,这可算是我学的第一个比较有用的"算法"啊...这怎么行! 结果: 1 void bubbleSort (elemType arr[], int len) { 2 elemType temp; 3 int i, 阅读全文
posted @ 2020-05-27 15:11 安之若醇 阅读(195) 评论(0) 推荐(0) 编辑
摘要:记得早在几十天以前,xty 学长曾让我学这个.一直推到了现在哈 咕咕咕(能鸽善鹉orz) 抱歉,学妹我来还愿了! 中缀表达式比较适合人类的计算,但是后缀表达式更适合机器计算(毕竟没有那么多运算符优先级) 下面贴一个中缀转后缀的代码 需要用到栈和队列还有map的知识(我还不太熟练orz) 1 // 2 阅读全文
posted @ 2020-05-24 14:38 安之若醇 阅读(383) 评论(1) 推荐(0) 编辑

Live2D服务支持
点击右上角即可分享
微信分享提示