![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
计算机学弱驴
这个作者很懒,什么都没留下…
展开
-
Pat 1139 First Contact (30分)
有错误,待修改//// Created by HP on 2020/9/7.//#include <iostream>#include <map>#include <string>#include <algorithm>#include <vector>using namespace std;int n,k,m;struct node{ string a,b;};int cmp(node x,node y){原创 2020-09-07 15:34:54 · 170 阅读 · 0 评论 -
PAT-1146 Topological Order (25分)
以下是我的错误代码,在写的时候遇到两个问题,一个是表示拓扑关系的g数组是循环使用的,二是装前驱节点的集合set也是循环使用的。可是第一轮就把他清空了,所有之后的询问不用判断就是正确的,卡了我半天。//// Created by HP on 2020/9/6.//#include <iostream>#include <vector>#include <set>using namespace std;set<int> s[1010];int原创 2020-09-06 23:17:17 · 95 阅读 · 0 评论 -
PAT-1126 Eulerian Path (25分)
开始的时候忘了要求是连通图的前提,14/25.第一次加判断连通性,因为形参没有传出来,一种错误以下代码是24/25 有一个点没有通过//// Created by ZhangXiaoYu@Ceres_lab on 2020/9/1.//#include <iostream>using namespace std;#include <vector>#include <map>//不要忘了前提要是一个连通图int ans[520];int m,n;原创 2020-09-01 17:24:31 · 105 阅读 · 0 评论 -
PAT-1150 Travelling Salesman Problem (25分)
没有输出的错误代码1过样例但是多处错误的代码2原创 2020-09-01 16:05:53 · 136 阅读 · 0 评论 -
PAT-1142-Maximal Clique
1142一遍ac//// Created by ZhangXiaoYu_TJUT on 2020/7/15.////如果只有一个节点的话,直接输出yes。是不是max任取一个节点的所有邻接节点,如果这个邻接节点也是别人的邻接节点,说明不是max//关于是不是clique:用邻接表表示就可以了,如果e[i][j]==1说明联通,这样遍历所有给出的节点,就可以了。#include <iostream>#include <vector>#include <unor原创 2020-09-01 11:06:56 · 148 阅读 · 0 评论 -
PAT-1151-LCA in a Binary Tree
1151参考浒鱼鱼//// Created by ZhangXiaoYu@Ceres_lab on 2020/8/31.//#include<iostream>#include <vector>#include <map>#include <cstdio>#include <algorithm>using namespace std;map<int,int> pos;vector<int> in原创 2020-08-31 17:48:05 · 87 阅读 · 0 评论 -
Floyd判圈法
物理的 上的 快慢相遇问题 ,明天补充。原创 2018-05-29 23:33:25 · 116 阅读 · 0 评论