自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 表达式转换 (25分)

借鉴了一位大佬的 只是没有注释文章目录题目输入格式:输出格式:输入样例:输出样例:我构造的几个样例题解注释很详细题目算术表达式有前缀表示法、中缀表示法和后缀表示法等形式。日常使用的算术表达式是采用中缀表示法,即二元运算符位于两个运算数中间。请设计程序将中缀表达式转换为后缀表达式。输入格式:输入在一行中给出不含空格的中缀表达式,可包含+、-、*、\以及左右括号(),表达式不超过20个...

2020-02-28 18:10:15 1126

原创 华为云黑白棋 - 第二讲 虚拟云服务器环境配置

文章目录1.首先打开华为云平台2.创建 虚拟私有云3.创建安全组和添加规则3.1创建3.2 添加规则4.购买弹性云服务器 氪金开始4.1 基础配置4.2 网络配置4.3 高级配置氪金成功5.配置服务器5.1 登陆5.2 安装服务器 --> 不知到为啥 我现在进不去 可能是卡了 用跟老师做的时候的截图了就5.3 安装 nodejs5.41 打开2 安装5.5 配置主机的授信5.6 太晚了 待续...

2020-02-27 21:33:08 3532

原创 华为云黑白棋 - 第一讲:Git 客户端和华为云的配置

文章目录安装Git配置Git使用Putty配置客户端华为云华为云配置安装Git官方下载地址下完上面的下这个提取码 uuo7:已经下载好的和汉化包和另一个东西注:安装汉化包的时候 在最后一个见面要勾选一个东西 前两个都直接 NEXT 即可配置Git找到这个出现这个界面要输入三次git config --global user.name “momomo”git confi...

2020-02-26 20:26:16 1090

原创 02-线性结构3 Reversing Linked List (25分) 简单

题解 静态链表先用了map确定他们的顺序再将mp赋值给结构体数组在结构体数组里进行反转反转用的是reverse函数有几个地方需要注意 ps: 在注释#include <iostream>#include <cstdlib>#include <vector>#include <map>#include <algorithm...

2020-02-25 15:31:16 467

原创 02-线性结构2 一元多项式的乘法与加法运算 (20分)

用结构体来记录下标和指数 查询比较麻烦#include <iostream>#include <cmath>#include <algorithm>using namespace std;const int MAX_N = 1e5;struct node{ int x; int z;};int N_1, N_2;node *read(...

2020-02-25 13:00:18 359

原创 java 获取两个日期间相差的天数

主要使用到SimpleDateFormat类,使用它的parse方法格式化时间,将字符串类型的日期,转换成Date类型。然后再使用Date类型的getTime分别获取开始时间和结束时间。 由于getTime获取的时间是毫秒。因此在计算天数的时候,需要除以一天时间的毫秒数(246060*1000)package 笔记;import java.text.ParseException;imp...

2020-02-24 09:38:56 2030

原创 返回 01-复杂度2 Maximum Subsequence Sum (25分) 翻译+题解

代码很详细#include <iostream>using namespace std;const int MAX_N = 1e4 + 10;int main(){ int start, end, sum; int x[MAX_N]; int temp; int n; cin >> n; sum = end = s...

2020-02-18 16:22:33 345 2

原创 VScode

VScode 肯定是最好的编程软件之一了 大部分童鞋 刚接触就放弃了因为配置起来太难了 网上教程还繁琐下面的文件 以简洁为主 已经配置好了文件 直接可以用 不用自己再配置点击进入百度网盘下载文件文件链接注:共有4个压缩包用法1.解压后将这两个文件放到2.VSC开头的文件是VScode程序,X86是编译器 最好把X86开头的文件放到C盘 注:X86是.7z格式,另附...

2020-02-15 10:43:01 608

原创 喊山

做的第一个l3的题思路不难 用BFS来搞 最外圈的就是答案一层层来循环找#include <iostream>#include <queue>#include <vector>using namespace std;const int MAX_N = 10005;//存图vector<vector<int>> x(M...

2020-02-13 19:09:05 298

原创 L2-010 排座位 (25分)

用两个vector 分别存放各自的朋友 敌人用并查集来看是不是有共同朋友思路较为简单注释比较详细#include <iostream>#include <vector>#include <numeric>using namespace std;const int MAX_N = 110;//朋友关系图int visited[MAX_N];...

2020-02-13 15:54:56 255

原创 天梯 抢红包

没什么思维难度 就是知道结构体排序即可注释较为详细#include <iostream>#include <algorithm>using namespace std;const int MAX_N = 10100;//自定义规则bool cmp(pair<int, pair<double, int>> a, pair<int...

2020-02-13 14:48:46 229

原创 Saruman's Army

传送门#include <iostream>#include <algorithm>using namespace std;const int MAX_N = 1100;int main(){ while (1) { int n, r; int arr[MAX_N]; scanf("%d%d", &...

2020-02-13 11:25:10 188

原创 4151:电影节

对结束时间进行排序每次记录结束的时间 选择可能播放的并且是结束时间最近的#include <iostream>#include <algorithm>using namespace std;const int MAX_N = 1000;struct node{ int s, e; bool operator<(const node &x)...

2020-02-12 15:55:15 336

原创 帅到没朋友

我当成图来做的 用的邻接表存图法 就是把他们几个点连到一起#include <iostream>#include <vector>using namespace std;int main(){ vector<vector<int>> X(100000); int N; scanf("%d", &...

2020-02-11 09:28:04 258

原创 大笨钟

稍微注意一下边界即可 12:00#include <iostream>using namespace std;int main(){ int s, f; scanf("%d:%d", &s, &f); int n = s - 12; if (f > 0) n++; if (n <= 0)...

2020-02-09 12:53:28 138

原创 到底有多二

#include <iostream>#include <iomanip>#include <string>using namespace std;int main(){ string s; cin >> s; double r = 0; int t = 0; for (auto c : s) ...

2020-02-09 12:45:45 364

原创 谷歌的招聘

题解把s当作一个队列 就是先进先出在输入的时候就进行判断 这叫同步进行 嘿嘿先把s加到L位 并判断是不是素数 是的话退出即可若不是 则把s的第一位删掉 在下一次循环中s就有加了新的数字在进行判断 上来一看就想到了暴力 但一想不能那么简单 看了看时间200ms 就想到了这个 算是比较快#include <iostream>#include <cmath&g...

2020-02-08 19:11:48 170

原创 最长对称子串 --哈希算法求 详细注释

题解常规做法和哈希做法在时间复杂度上有很大的差距哈希做法会快很多很多1.正向 反向 都求其映射值2.枚举中心点3.二分法求半径 看两边的映射值哈希算法很常用 最后要知道 可以先去搜一下哈希的作用正常做法哈希时间差的还是蛮多的注释很详细#include <iostream>#include <algorithm>#include <st...

2020-02-07 12:00:15 324

原创 map 函数

#include <iostream>#include <map>using namespace std;int main(){ //——————————————————————————————————这个默认删除 map<string, int> mp = {{"Tom", 0}, {"Tom", 1}, {"Bob", 100}, {...

2020-02-06 16:23:04 210

原创 set 函数

初始化一个set<int> st = {8, 2, 3, 4, 5, 5, 5, 5};创建迭代器这样会很方便的创建 让auto 自己去判断 auto t = st.begin(); t++;erase3种用法 比较有趣 //erase 1. 两个参数 删除这两个迭代器之间的数 st.erase(t, st.end()); //e...

2020-02-06 15:45:14 852

原创 字符串哈希

题目连接通过这个题目来初步认识哈希算法#include <iostream>#include <string>using namespace std;typedef unsigned long long ULL;char s[100010];//第i位放的是第1位到第i位的哈希值ULL hashq[100010];//dp里放权值ULL dp[10...

2020-02-06 14:56:36 131

原创 快速幂算法

#include <iostream>using namespace std;int pow(int a, int b){ int r = 1; while (b) { if (b & 1) r *= a; a *= a; b >>= 1; } re...

2020-02-05 19:35:58 126

原创 L2-032 彩虹瓶 (25分) vector和stack

注释详细#include <iostream>#include <stack>#include <vector>using namespace std;int N, M, K;int check(){ //该放的瓶子数 int cur = 1; // stack<int> s; vector<int...

2020-02-05 18:37:44 332

原创 C++输出

#include <iostream>#include <iomanip>using namespace std;int main(){ //1. 一共有4个字符 在输出真正字符的 前面填充0 cout << setw(4) << setfill('0') << 11; //0011 /****************...

2020-02-05 11:44:37 477

原创 L2-017 人以群分STL

用到了一个函数 我博客里有 直接搜名字即可#include <iostream>#include <algorithm>#include <numeric>#include <cmath>using namespace std;int main(){ int n; cin >> n; int a[n]...

2020-02-05 11:16:11 186

原创 accumulate详细用法

accumulate作用是累加一个数组的元素定义在头文件 < numeric >accumulate(vt.begin(), vt.end(), 0);第三的参数是起始数#include <iostream>#include <numeric>#include <string>#include <vector>#...

2020-02-05 09:08:16 1654

原创 功夫传人 BFS

不算太难一开始我想的是并查集 结果并着并着成了广搜 我看有人用的是并查集和DFS我觉得BFS好理解一点很快我就到13分了。。。结果被剩下了卡了一下午最后发下是r 算的不对 又上了不认真看题的当。。。我以为是r直接乘代没想到样例也过。。。 其实是r*代数个r“每向下传承一代,就会减弱r%”#include <iostream>#include <queue&gt...

2020-02-04 18:52:56 304

原创 家庭房产 并查集和DFS两种————详细!!!

比较开心 虽然做的时间比较长这是我第二个做的这种类型的并查集 上一个是 部落题解难的地方是怎么存数据单独开一个数组 以每个家族的族长为下标来存数据在输入的时候的把一个部落的都连在一起在把人们的祖先用set过一遍去重 set的大小就是部落的个数注释很详细#include <iostream>#include <numeric>#include &l...

2020-02-03 19:58:45 486

原创 集合相似度

// 题解 ://用set去掉一个集合中相同的元素//然后判断相等的对数 分母是 去掉重复元素之后的总个数-相等的对数#include <iostream>#include <set>using namespace std;int main(){ int n; cin >> n; set<int> x[n ...

2020-02-03 14:43:19 269

原创 查验身份证

我现在才知道 加权原来是乘啊#include <iostream>#include <string>using namespace std;int main(){ int a[17] = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2}; char z[11] = {'1', '0', 'X', '...

2020-02-03 11:10:48 151

原创 跟奥巴马一起画方块

题目应该有问题 说的是四舍五入取整… 明明就是上取整好嘛用ceil上取整来跟奥巴马一起左手右手一起画方块 左手右手就是一个穿天猴>>>#include <iostream>#include <cmath>using namespace std;int main(){ double s; int n; char c; cin &...

2020-02-03 10:31:05 215

原创 计算阶乘和 递归

#include <iostream>using namespace std;int sum = 0;int fact(int k){ if (k == 0 || k == 1) return 1; else return k * fact(k - 1);}int main(){ int n; cin >> n; for (int i = 1...

2020-02-03 10:17:28 326

原创 A-B 两种方法

用了两函数 用法可再我的博客里找到直接搜 find就可#include <iostream>#include <string>using namespace std;int main(){ string s, s1; int a[150] = {0}; getline(cin, s); getline(cin, s1); for (auto c : s...

2020-02-03 10:05:39 871

原创 比较大小

#include <iostream>#include <algorithm>using namespace std;int main(){ int a[3]; int n = 3; int t = 0; while (n--) { cin >> a[t++]; } sort(a, a + 3, [](int x, int y) { r...

2020-02-03 09:49:04 153

原创 N个数求和

约分必须要多进行 不然会溢出注释比较详细#include <iostream>using namespace std;//最小公约数int divisor(int a, int b){ int r = 1; while (r) { r = a % b; a = b; b = r; } return a;}//最大公倍数int maxdivi(in...

2020-02-03 09:34:35 736

原创 L2-024 部落 详细哦!!! 并查集

题解// 题解// 用并查集// 一开始把每个部落的第一人当作头头// 在输入的时候// 如果B部落发现 人a已经有头头A了 就让人a的头头A 的头头变为B// 也就是 a->A->B// 但如果a就是B的话 让a的头头是a 即他本身(否者会死循环 a的是A A的是a)#include <iostream>#include <vector>...

2020-02-02 17:55:26 477

原创 L2-022 重排链表 三种方法

思路用地址做下标查的时候直接用下标再用一个vector存顺序弄好的链表再搞一个node数组放ans开了两个数组 一个vectorvector放中间结果 过度作用mid和ans记住的都是idmid是正常顺序的 ans是乱序的期间一直有个点不对 经过无数次的尝试之后 。。。md!!! 测试点3竟然是 第1个结点的地址在数据中没有!!!没有!!!dog…very dog00...

2020-02-02 16:22:52 455

原创 整除光棍

一开始以为是大数除法 吓得没敢作其实就是模拟了一下除法而已比如 111111/7其实一开始是 11/7商1 余4 把商直接输出再用41(410+1)/7商5 余6…直到余数10+1 模除7==0的时候停止#include <iostream>using namespace std;int main(){ int n; cin >>...

2020-02-02 10:52:39 256

原创 阅览室

有两个点一直过不去最后才知道 是我想多了如果书1 第一次被借阅在10点 第二次有被借在11点 是应该忽略第一次 而不是第二次还有最后的输出 我一直以为是上取整 原来是四舍五入 printf("%.0lf",a); #include <iostream>#include <cmath>#include <cstring>using namespac...

2020-02-02 09:10:36 321

原创 点赞狂魔

你们知道一共6个点 对了5个 那5个10分 剩下一个15分的感觉吗…啊 那排序啥玩意那是 搞的我研究的好久。。就差那么一点。。还是没研究出来。。。题解:用到了set 话说我还是第一次用set做题 用set来统计一共多少个不同的兴趣一开始我没想到用结构体 到了排序的时候才用我是定义的三二个东西 放姓名的name 放人兴趣个数的num 和 统计多少不同兴趣的set a之后再用一个循环把他...

2020-02-01 19:50:23 300 2

空空如也

空空如也

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

TA关注的人

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