1074 Reversing Linked List (25 分) Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, if K=3, then you must output 3→2→1→6→5→4; if K=4, you must outp
PTA甲级1094 The Largest Generation (25分) A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the largest population. Input Specificatio
目录 B1061 Dating (20分) 题目原文 Input Specification: Output Specification: Sample Input: Sample Output: 生词如下 题目大意 注意点: 总结和反思 B1061 Dating (20分) 首先,先贴柳神的博客 https://www.liuchuo.net/ 这是地址 想要刷好PTA,强烈推荐柳神的博客,和算法笔记 题目原文 Sherlock Holmes received a note with some
[程序思路] 先根据地址按顺序读入节点,入栈,当栈里的元素个数等于k时全部出栈,并按出栈顺序保存,最后若栈不为空,则全部出栈并按出栈的稀饭顺序保存,最后输出各节点 注意:输入的节点中有可能存在无用节点需要过滤,这里我使用map映射来实现过滤 [代码实现] #include<bits/stdc++.h> using namespace std; struct node{ int addrest,data,next; }t; int stk[100005]; int main(){ map<