自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 MCP 实战系列(Day 2)- 动手搓个文件系统 MCP 服务器

《从原理到实战:掌握 MCP》系列的第二篇文章,动手搓个文件系统 MCP 服务器吧。

2025-04-09 00:46:58 722

原创 MCP 实战系列(Day 1):什么是 MCP?

MCP是一个开放协议,它标准化了应用程序如何为 AI 模型提供上下文。你可以把 MCP 想象成 AI 应用程序的 USB-C 端口,就像 USB-C 提供了一个标准方式连接设备和各种外设一样,MCP 提供了一个标准方式让 AI 模型连接不同的数据源和工具。实际上,对小白来说,官方的例子还不够直观。以下,我会用更直白的例子解释 MCP 的核心概念。本文介绍了 MCP 协议的概念以及如何在 Cline 中配置一个 MCP Server,下一篇文章将介绍如何搭建一个自己的 MCP Server。

2025-04-01 01:08:50 754

原创 拼题A(Pintia)刷题插件 for VS Code

用于 Pintia(PTA) 的刷题插件 on VS Code.

2022-08-06 18:39:55 15009 8

原创 VS Code 预览版 Copilot 终于支持 MCP 了:试试使用 MCP 快速查询 GitHub Issues 吧

VS Code Insiders 支持 MCP Servers 了,试试使用 GitHub MCP Server 快速获取仓库的所有 Issues 吧

2025-04-02 15:39:54 793

原创 拼题A(PTA)公共题集题解收录

拼题 A 公共习题的题解收录

2023-01-27 17:08:54 7551 2

原创 7-46 新浪微博热门话题 (30分) (字符串解析)

PTA数据结构与算法题目集(中文): 7-46 新浪微博热门话题 (30分)新浪微博可以在发言中嵌入“话题”,即将发言中的话题文字写在一对“#”之间,就可以生成话题链接,点击链接可以看到有多少人在跟自己讨论相同或者相似的话题。新浪微博还会随时更新热门话题列表,并将最热门的话题放在醒目的位置推荐大家关注。本题目要求实现一个简化的热门话题推荐功能,从大量英文(因为中文分词处理比较麻烦)微博中解析出...

2020-03-30 17:16:56 1135 1

原创 PAT A1106 Lowest Price in Supply Chain (25分) (DFS+剪枝)

PAT甲级:A1106 Lowest Price in Supply Chain (25分)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.S...

2020-03-29 09:18:11 208

原创 PAT A1091 Acute Stroke (30分) (BFS广度优先搜索)

PAT甲级:A1091 Acute Stroke (30分)One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions are identified in e...

2020-03-03 23:39:55 174

原创 PAT A1111 Online Map (30分) (Dijkstra最短路径算法)

PAT甲级:A1111 Online Map (30分)Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is the shortest, and the ...

2020-03-02 22:14:27 279

原创 PAT A1095 Cars on Campus (30分) (模拟问题)

PAT甲级:A1095 Cars on Campus (30分)Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with all...

2020-03-01 13:53:04 367

原创 PAT A1087 All Roads Lead to Rome (30分) (Dijkstra+DFS)

PAT甲级:A1087 All Roads Lead to Rome (30分)Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the mos...

2020-02-29 21:15:43 220

原创 PAT A1107 Social Clusters (30分) (并查集)

PAT甲级:A1107 Social Clusters (30分)When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. A social cluster is a s...

2020-02-28 21:02:29 167

原创 PAT A1103 Integer Factorization (30分) (DFS+剪枝)

PAT甲级:A1103 Integer Factorization (30分)The K−P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are supposed to write a program to find the...

2020-02-28 21:00:59 177

原创 PAT A1119 Pre- and Post-order Traversals (30分) (先序和后序序列建树)

PAT甲级:A1119 Pre- and Post-order Traversals (30分)Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inor...

2020-02-28 20:57:28 234

原创 PAT A1123 Is It a Complete AVL Tree (30分) (AVL树 和 CBT判定)

PAT甲级:A1123 Is It a Complete AVL Tree (30分)An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time ...

2020-02-26 17:45:28 353

原创 Python实现博客站点url实时推送至百度与Linux定时任务

之前写过一篇关于【Hexo】maupassant 主题设置百度站点自动推送 的博客这种自动推送的方式也只有在页面受访时才会被提交至百度,只可惜百度对个人博客url的收录速度确实无法跟Google比呀,因此编写Python脚本通过站点的 sitemap.xml 与Linux定时任务实现 主动推送 的自动化。

2020-02-26 11:43:16 1430

原创 PAT A1127 ZigZagging on a Tree (30分) (不建树)

PAT甲级:A1127 ZigZagging on a Tree (30分)Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traver...

2020-02-25 23:22:09 184

原创 PAT A1131 Subway Map (30分) (DFS + 简单剪枝)

PAT甲级:A1131 Subway Map (30分)In the big cities, the subway systems always look so complex to the visitors. To give you some sense, the following figure shows the map of Beijing subway. Now you are sup...

2020-02-25 21:32:48 359

原创 PAT A1135 Is It A Red-Black Tree (30分) (DFS 红黑树的判定)

PAT甲级:1135 Is It A Red-Black Tree (30分)There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties:(1) Every node is either red or b...

2020-02-24 18:01:15 264

原创 PAT A1139 First Contact (30分)

PAT甲级:1139 First Contact (30分)Unlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle in the early years. When a boy A had a crush on a girl B, he would usu...

2020-02-24 18:00:41 412

原创 PAT A1143 Lowest Common Ancestor (30分) (平衡二叉树中的最低公共祖先)

PAT甲级:A1143 Lowest Common Ancestor (30分)The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.A binary search tree (BST) is recursi...

2020-02-24 17:59:52 253

原创 PAT A1147 Heaps (30分) (堆的判定)

PAT甲级:A1147 Heaps (30分)In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either gre...

2020-02-24 17:59:02 183

原创 Hexo 添加对 Graphviz 的支持

什么是Graphviz?Graphviz是开源的图形可视化软件。图形可视化是一种将结构信息表示为抽象图形和网络图的方式。它在网络,生物信息学,软件工程,数据库和网页设计,机器学习以及其他技术领域的可视界面中具有重要的应用。以上是Graphviz实现作图的示例展示,通过类似于Markdown标记语言的形式,Graphviz使用Dot文本图形描述语言来实现作图。Hexo添加对Graphviz的...

2020-02-24 11:14:03 433

原创 7-10 公路村村通 (30分) (最小生成树Prime与Kruskal算法)

PTA数据结构与算法题目集:7-10 公路村村通 (30分)现有村落间道路的统计数据表中,列出了有可能建设成标准公路的若干条道路的成本,求使每个村落都有公路连通所需要的最低成本。输入格式:输入数据包括城镇数目正整数N(≤1000)和候选道路数目M(≤3N);随后的M行对应M条道路,每行给出3个正整数,分别是该条道路直接连通的两个城镇的编号以及该道路改建的预算成本。为简单起见,城镇从1到N编号...

2020-02-24 00:47:36 1770

原创 7-14 电话聊天狂人 (25分)

PTA数据结构与算法题目集:7-14 电话聊天狂人 (25分)给定大量手机用户通话记录,找出其中通话次数最多的聊天狂人。输入格式:输入首先给出正整数N(≤105),为通话记录条数。随后N行,每行给出一条通话记录。简单起见,这里只列出拨出方和接收方的11位数字构成的手机号码,其中以空格分隔。输出格式:在一行中给出聊天狂人的手机号码及其通话次数,其间以空格分隔。如果这样的人不唯一,则输出狂人...

2020-02-24 00:46:16 1335

原创 7-7 六度空间 (30分) (BFS)

PTA数据结构与算法题目集:7-7 六度空间 (30分)“六度空间”理论又称作“六度分隔(Six Degrees of Separation)”理论。这个理论可以通俗地阐述为:“你和任何一个陌生人之间所间隔的人不会超过六个,也就是说,最多通过五个人你就能够认识任何一个陌生人。”如图1所示。“六度空间”理论虽然得到广泛的认同,并且正在得到越来越多的应用。但是数十年来,试图验证这个理论始终是许多...

2020-02-22 19:22:49 626

原创 7-21 求前缀表达式的值 (25分)

PTA数据结构与算法题目集:7-21 求前缀表达式的值 (25分)算术表达式有前缀表示法、中缀表示法和后缀表示法等形式。前缀表达式指二元运算符位于两个运算数之前,例如2+3*(7-4)+8/4的前缀表达式是:+ + 2 * 3 - 7 4 / 8 4。请设计程序计算前缀表达式的结果值。输入格式:输入在一行内给出不超过30个字符的前缀表达式,只包含+、-、*、/以及运算数,不同对象(运算数、运...

2020-02-22 19:21:48 1181

原创 PAT甲级 2019年春季考试(最简短的代码)

真题估计还得一年才能补充到PAT题库里,做题还需要去教育超市购买,坑呀!7-1 Sexy Primes (20分)Sexy primes are pairs of primes of the form (p, p+6), so-named since “sex” is the Latin word for “six”. (Quoted from http://mathworld.wolfram...

2020-02-21 18:45:05 425

原创 PAT A1053 Path of Equal Weight (30分) (DFS + 剪枝)

PAT甲级:A1053 Path of Equal Weight (30分)Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to L is defined to be the sum of the weights of...

2020-02-16 20:48:47 233

原创 【算法】二叉树顺序存储结构建树方法

顺序存储结构,即使用数组存储,结点从下标为1的位置开始存储,a[i * 2]和a[i * 2 + 1]分别表示a[i]结点的左右孩子。其中若孩子为空,则用 -1 代替。定义结构体:struct node { int data; node *left, *right; node(int x) : data(x) { left = right = NULL; }};...

2020-02-14 15:17:22 1103

原创 树状数组及查询第K小的数

宏定义lowbit函数#define lowbit(x) ((x) & (-x))add函数,更新当前元素时将所有可分解出当前数的元素均加上 vvoid add(int x, int v) { for (int i = x; i < N; i += lowbit(i)) c[i] += v;}getSum函数,得到前x个元素累加和int getSu...

2020-02-14 15:17:05 487

原创 【算法】二分查找详细总结 BinarySearch

二分查找算法的两种实现:第一种:各类教材、百科的常见写法int binarySearch(vector<int> &a, int x) { int left = 0, right = a.size() - 1, mid; while (left <= right) { mid = (left + right) / 2; ...

2020-02-14 15:09:07 393

原创 【算法】二叉树输出根节点到某结点的路径

分析(递归):空树,则查找失败,返回 false当前结点为所要查找的值,输出结果,返回 true以上条件不满足,则向左找或向右找,找着了说明当前结点是根到x路径上的点,输出并返回 true左右都找不到,查找失败,无此结点,返回 falsebool printPath(node* root, int x) { if (root == NULL) return false; ...

2020-02-14 15:06:45 5688

原创 【算法】判断是否为二叉搜索树

题目来源:98. Validate Binary Search Tree习题4.3 是否二叉搜索树 (25分)输入: 2 / \ 1 4 / \ 3 5输出: true输入: 5 / \ 1 4 / \ 3 6输出: false起初使用堆的方式判定是不对的,二叉搜索树的任意结点应该 总大于...

2020-02-14 15:05:34 869

原创 【算法】动态规划 - 最长不下降子序列(LIS)

最长不下降子序列(Longest Increasing Sequence):在一个数字序列中,找到一个最长的子序列(可以不连续),使得这样的子序列是不下降(即非递减)的。例如序列 a = {1, 2, 3, -1, -2, 7, 9},它的最长不下降子序列是 {1, 2, 3, 7, 9} 长度为5,{1, 2, 3} 和 {-2, 7, 9} 也是非递减序列但不是最长的。动态规划求解:dp[...

2020-02-14 15:04:26 835

原创 【算法】树的同构 Isomorphism

给定两棵树 T1 和 T2,如果 T1 可以通过若干次左右孩子互换变成 T2,则称两棵树是 同构 的。相关题目:7-3 树的同构 (25分)6-7 Isomorphic (20分)分析(递归求解):都为空树,视为同构 => True其中一棵为 NULL => False以上条件不满足,则两棵树均不为空,此时若值不相等,则不是同构 => False当前两结点...

2020-02-14 15:00:40 290

原创 【笔记】并查集

不管后面写了啥,一定要把最重要的写在前面:(总记不住)使用并查集前 一定要初始化、一定要初始化、一定初始化用 findFather(i) 找根结点,不是 father[i] 数组并查集的基本操作使用数组表示并查集:int father[N];father[i] 表示元素 i 的父亲结点初始化初始情况下,每个元素都是单独的集合,因此其父结点是自己,这在并查集中被称为 Refle...

2020-02-14 14:58:55 141

原创 【笔记】C语言的特殊输入问题

在 PTA 上问题碰到特殊输入问题,做个小的笔记。在 L2-012 关于堆的判断 (25分) 这道题中,题目要求对给出的命题做判断,因为所给的命题是不确定的,无法在程序中直接使用scanf的格式化输入。最初通过cin >> string的方式读入数据,通过字符串解析、求子串取出数据,提交的代码出现运行时错误,之后是发现题目中说给的数据是包括负数的,包含负数对扣数字的操作又要麻烦不少。...

2020-02-14 14:57:54 270

原创 【C/C++】move函数的概念与使用

std::move is used to indicate that an object t may be “moved from”, i.e. allowing the efficient transfer of resources from t to another object.In particular, std::move produces an xvalue expression ...

2020-02-14 14:56:22 3326

原创 PAT 1063 Set Similarity (25分) 使用set与map的超时问题

在 1063 Set Similarity (25分) 这道题目中,使用 unorderd_set 和 unordered_map 时出现超时问题,Given two sets of integers, the similarity of the sets is defined to be Nc/Nt ×100%, where Nc is the number of distinct commo...

2020-02-14 14:55:20 239

空空如也

空空如也

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

TA关注的人

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