随笔分类 -  PAT刷题证道

摘要:这题写得比较痛苦。首先有点不在状态,其次题目比较难读懂。 “Gang”成立的两个条件:①成员数大于两个 ②边权总和大于阈值K 首先,在录数据的时候通过map或者字符串哈希建立string到int的映射。 然后,这个题的数据结构其实是带权无向图。在录数据的时候就要处理好点权和边权。 最后,对所有顶点做 阅读全文
posted @ 2018-03-05 22:40 TQCAI 阅读(200) 评论(0) 推荐(0)
摘要:bfs(23分,case3无法通过。经查是bfs结构写错): #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <s 阅读全文
posted @ 2018-03-05 20:42 TQCAI 阅读(156) 评论(0) 推荐(0)
摘要:dfs解法: 阅读全文
posted @ 2018-03-05 19:39 TQCAI 阅读(141) 评论(0) 推荐(0)
摘要:这题写得头晕……明天我再评价 #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack> #include < 阅读全文
posted @ 2018-01-14 20:00 TQCAI 阅读(156) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack> #include <queue> #include 阅读全文
posted @ 2018-01-03 21:38 TQCAI 阅读(266) 评论(0) 推荐(0)
摘要:太简单了 阅读全文
posted @ 2018-01-01 16:50 TQCAI 阅读(193) 评论(0) 推荐(0)
摘要:写了三遍才AC,这真是对智商极大的侮辱 C++代码: #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack 阅读全文
posted @ 2018-01-01 16:12 TQCAI 阅读(373) 评论(0) 推荐(0)
摘要:代码: #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack> #include <queue> #inc 阅读全文
posted @ 2017-12-30 12:37 TQCAI 阅读(251) 评论(0) 推荐(0)
摘要:对A1135这题有心里阴影了,今天终于拿下AC。学习自柳神博客:https://www.liuchuo.net/archives/4099 首先读题很关键: There is a kind of balanced binary search tree named red-black tree in 阅读全文
posted @ 2017-12-29 22:14 TQCAI 阅读(664) 评论(0) 推荐(0)
摘要:考试的时候有思路了,但是没写完。这题起码要40min写,思路太诡异了。 刚刚写了一段,只过了一个case,得了18分,还行。明日再战。 #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #includ 阅读全文
posted @ 2017-12-18 22:50 TQCAI 阅读(248) 评论(0) 推荐(0)
摘要:参考了博客上码量不到50行的代码,完成了这题的AC重构。感觉真的基础很重要,这题其实是很简单的一道树的前中后序的题目。但是我之前练习的时候,都是用的自己总结的骚套路,虽然理解起来很直观,但是用了动态数组(vector),时间复杂度比较大。这题问题规模n=5e4,时间控制600ms,虽然已经AC了,但 阅读全文
posted @ 2017-12-18 21:30 TQCAI 阅读(309) 评论(0) 推荐(0)
摘要:这应该是比较简单的一个模拟题,但是考试的时候花了较长的时间,并且最后一个case没过,丢了6分。这题的通过率不高,可见最后一个case还是有挑战性的。 考试的时候想的是在录数据的时候建立一个【ID】到【成绩信息】的映射,但是看网上代码用一个数组来录信息,然后建立【ID】到【数组索引】的映射。根据我的 阅读全文
posted @ 2017-12-18 14:36 TQCAI 阅读(229) 评论(0) 推荐(0)
摘要:题目链接: https://www.patest.cn/contests/pat-a-practise/1136 今天是12月17号。最近这几天都有点不在状态。已经整整一周没有练算法了,自从12.3考了ccf,12.9考了pat,打击很大。 前几天想刷考试时的第一题,没想到重新写一遍也没过所有cas 阅读全文
posted @ 2017-12-17 13:40 TQCAI 阅读(445) 评论(0) 推荐(0)