![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
假期作业
文章平均质量分 73
理想国の糕
天真永不消逝,浪漫至死不渝
展开
-
PTA写BUG日志——关于数据结构里面的“树”(算法笔记上机实战)
二叉树的遍历先序遍历中序遍历后序遍历层序遍历经典问题1:给出两个遍历树的序列,如何复现树?????答:一定会需要中序遍历来区分左右子树,中序遍历+(剩余3种任一遍历的数组即可复现原来的树的结构)练习1PTA甲级1020这题是根据中序和后序来复现树的结构,再用层次遍历输出即可,思路不是特别难,主要涉及复现函数create以及层次遍历函数levelTravel复现函数《算法笔记》给了先序+中序的版本,可以参考画图加深理解//1020#include<bits/stdc+原创 2021-08-16 00:01:36 · 177 阅读 · 1 评论 -
PTA写BUG日志——数据结构专题(算法笔记上机实战)
栈的应用PTA甲级1051 Pop Sequence (25 分)这题,俺稍微作弊了一下提前看了题解,确实没有思路嘤嘤嘤????//1051#include<bits/stdc++.h>using namespace std;int m,n,k;const int maxn=1100;int main(){ scanf("%d %d %d",&m,&n,&k); vector<int>a(n+1); stack<int>s;原创 2021-08-03 10:16:35 · 216 阅读 · 0 评论 -
PTA写BUG日志——STL库函数(算法笔记上机实战)
Vector第一例PTA甲级1039Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the registered course list for each student who comes for a query.Input Specification原创 2021-07-30 11:41:20 · 174 阅读 · 0 评论 -
PTA写BUG日志——数学问题(算法笔记上机实战)
数学问题第一弹PTA 乙级10031003 我要通过! (20 分)“答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于 PAT 的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。得到“答案正确”的条件是:字符串中必须仅有 P、 A、 T这三种字符,不可以包含其它字符;任意形如 xPATx 的字符串都可以获得“答案正确”,其中 x 或者是空字符串,或者是仅由字母 A 组成的字符串;如果 aPbTc 是正确的,那么 aPbATca 也原创 2021-07-26 11:58:28 · 181 阅读 · 0 评论 -
PTA写BUG日志——活用递推、打表以及其他一些算法的奇淫巧计(算法笔记上机实战)
活用递推第一弹PTA 甲级1093、乙级10401093 Count PAT’s (25 分)The string APPAPT contains two PAT’s as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, and the 6th characters.Now give原创 2021-07-26 10:27:42 · 140 阅读 · 0 评论 -
PTA写BUG日志——two pointers(算法笔记上机实战)
tow pointers 第一弹PTA1029 Median这题……不难,一遍AC了。????要说有坑的话,注意一下数组内数字是long型就行,感觉考的是merge的变式。其实对于Two Pointer 而言,如书中所说,更像是一种编程技巧,感觉还是得多练练,找手感酱紫~(加油加油)附上AC代码://1029#include<bits/stdc++.h>using namespace std;const int maxn=300000;typedef long long ll原创 2021-07-25 11:43:20 · 85 阅读 · 0 评论 -
PTA写BUG日志——二分篇(算法笔记上机实战)
二分第一弹PTAA1085/B1030完美数列第一次做的时候没有考虑二分,暴力两次迭代果然有一个测试点卡住了,这题思路不是很难,我的二分写的应该有点问题,不过因为测试点不多,所以AC了,有空再回来看看,改一下附上有点菜的二分AC代码://A1085#include<bits/stdc++.h>using namespace std;long long int num[110000];int n;long long p;int f(int low,int high,long l原创 2021-07-23 22:27:15 · 102 阅读 · 0 评论 -
Pytorch网课学习——词向量以及论文的复现
关于词向量复现的论文为:《Distributed Representations of Words and Phrases and their Compositionality》论文传送门实现的编译器为:Jupyter Notebook第一步:首先导入实验需要用的包,以及设置一些超参数:# Word2Vec:Skip_Gram用中心词预测周围的词#pan.baidu.com/s/1tFeK3mXuVXEy3EMy3EMarfeWvgimport torch.nn as nnimport to原创 2021-07-19 17:38:47 · 121 阅读 · 3 评论 -
PTA写BUG日志——贪心篇(算法笔记上机实战)
贪心第一弹B1023组最小个数这题不难,属于基础题,第一次提交的时候忽略了一个小细节,就是判断有0之后需要定位第一个非零的数字并输出,代码中的这一行,需要注意的是,需要判断啊a[i]不为0,否则会超时以及输出错误(细心,细心,细心)if(flag&&i&&a[i]){//1023组个数最小#include<bits/stdc++.h>using namespace std;int a[10];bool flag=false;int main()原创 2021-07-19 11:47:54 · 143 阅读 · 0 评论 -
PTA写BUG日志——哈希篇(算法笔记上机实战)
2021年7月16日哈希第一弹题目传送门–B1033旧键盘打字没错没错,这是2/5通过率版本,第一版3/5,改了之后不仅还是超时,结果正确率又降了,嘤嘤嘤~~//1033#include<bits/stdc++.h>using namespace std;char test[200000];char bad[100];bool flag=false;map<char,int>mp;int main(){ scanf("%s%s",bad,test); for原创 2021-07-16 10:12:06 · 175 阅读 · 0 评论 -
2021寒假_菜菜子编程日志
偷偷过蓝桥2018_08题最近在学BFS 别骂了别骂了,知道错了,正在赶进度所以看到这题套用了正在学的BFS模板顺便用我那并不充足的知识库添了一些算法结果……答案出来了时间也超了//经典的BFS问题#include<stdio.h>#include<queue>#include<string.h>using namespace std;const int maxn=1006;int n;//地图大小 //位置 struct Point原创 2021-01-27 16:51:25 · 71 阅读 · 0 评论