![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C/C++
Linear Algebra and Geometry
这个作者很懒,什么都没留下…
展开
-
1098 Insertion or Heap Sort (25 分) +测试要点
题目描述1098 Insertion or Heap Sort (25 分)According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data, finds the locati原创 2021-09-08 16:01:25 · 236 阅读 · 0 评论 -
1107 Social Clusters (30 分) + 测试要点
题目描述1107 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 set of people who have some of their hobbies in common. Yo原创 2021-09-06 17:09:04 · 160 阅读 · 0 评论 -
1066 Root of AVL Tree (25 分) + 测试要点
题目描述1066 Root of AVL Tree (25 分)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 they differ by more than one, rebalancing is done to restore this原创 2021-09-03 01:06:49 · 262 阅读 · 0 评论 -
1043 Is It a Binary Search Tree (25 分) + 测试注意点
题目描述:A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node’s key.The right subtree of a node contains only nodes with keys greate原创 2021-09-06 17:05:58 · 319 阅读 · 0 评论 -
1053 Path of Equal Weight (30 分) + 容易忽略的测试测试点
题目描述:1053 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 all the nodes along the path from R to any leaf node L原创 2021-08-31 21:29:17 · 401 阅读 · 3 评论 -
codeup - B: 数制转换 - 给出个人错误原因和测试数据
AC代码错误原因:char num[400];和char res[500];最初大小分别是40和50,不够大#include<stdio.h>#include<string.h>int main(){ int a,b; char num[400]; while(scanf("%d%s%d",&a,num,&b)!=EOF) { char res[500]; long c=0; int len=strlen(num); //print原创 2021-03-08 21:18:58 · 89 阅读 · 0 评论 -
codeup - A: 又一版 A+B - 不用数组存储而是直接输出&&给出测试数据
AC代码#include <iostream>#include<cstdio>#include<algorithm>#include<math.h>#include<stdlib.h>using namespace std;int main(){ long long int a,b; int m; while(cin>>m) { if(m==0) break;原创 2021-03-01 22:47:41 · 71 阅读 · 0 评论 -
codeup - 打印日期 - 给出测试数据
AC代码// 以及需要的头文件int main(){ int m,n; while(cin>>m>>n){ int leap=isLeap(m); int i,d=0; for(i=1;;i++) { n=n-month[i][leap]; if(n<=0) { d=n+month[i][leap];原创 2021-02-18 20:09:19 · 78 阅读 · 0 评论 -
codeup - 入门模拟->日期处理 - 人间大迷惑
ac代码#include <iostream>#include<cstdio>#include<algorithm>#include<math.h>#include<cstring>#include<time.h>using namespace std;/*2013010120130105201302052013010120000101200101052013010120140105*/int原创 2021-02-17 21:35:34 · 78 阅读 · 0 评论 -
codeup 问题 B: Hello World for U
AC代码#include <iostream>#include<cstdio>#include<algorithm>#include<cstring>using namespace std;int main(){ char str[1000]; cin>>str; int len=strlen(str); int a=len/3;// int b=len-2*a int b=le原创 2021-02-16 19:54:34 · 90 阅读 · 0 评论 -
1002 A+B for Polynomials (25分) 测试用例+犯了所有可能犯的错误
原题1002 A+B for Polynomials (25分)This time, you are supposed to find A+B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomial:wh原创 2020-08-29 17:00:06 · 1684 阅读 · 4 评论 -
PAT 1001 A+B Format (20分)
通过代码#include<iostream>#include<cstdio>#include<string>#include<algorithm>#include<list>#include<string>using namespace std;bool gt(const int &a, const int &b) { return a>b;}int main() { in原创 2020-08-16 17:58:18 · 81 阅读 · 0 评论 -
PAT 1009 说反话 (20分)
通过代码#include<iostream>#include<cstdio>#include<string>#include<algorithm>#include<list>#include<string>using namespace std;int main() { string str; getline(cin,str); list<string> lst; strin原创 2020-08-16 17:16:05 · 144 阅读 · 0 评论 -
PAT 1008 数组元素循环右移问题 (20分)
通过代码#include<iostream>#include<cstdio>#include<string>#include<algorithm>#include<list>using namespace std;bool gt(const int &a, const int &b) { return a>b;}int main() { list<int> lst;原创 2020-08-15 15:23:58 · 85 阅读 · 0 评论 -
PTA 1006 换个格式输出整数 (15分)
#include<iostream>#include<cstdio>#include<string>#include<algorithm>using namespace std;int num[3];int main() { int n; int i=2; cin>>n; while(i>=0) { num[i] = n%10; n=n/10; i原创 2020-08-14 18:07:18 · 95 阅读 · 0 评论 -
PAT 1005 继续(3n+1)猜想 (25分)
自拟测试点63 5 6 7 8 113:5 8 4 2 15:√6:3 (…√)但不算是被覆盖了,是关键数7:11 16 8 4 2 18:√11:√46 3 2 16:3 5 8 4 2 13:√2:√ans:647 4 9 127:11 16 8 4 2 14:√9:14 7 (7被覆盖)(…√)12:6 3 5 8 (…√)ans:7 9 12...原创 2020-08-14 17:36:00 · 150 阅读 · 0 评论 -
PAT 1004 成绩排名 (20分) 犯了所有可能犯的错误
原题1004 成绩排名 (20分)读入 n(>0)名学生的姓名、学号、成绩,分别输出成绩最高和成绩最低学生的姓名和学号。输入格式:每个测试输入包含 1 个测试用例,格式为第 1 行:正整数 n第 2 行:第 1 个学生的姓名 学号 成绩第 3 行:第 2 个学生的姓名 学号 成绩 ... ... ...第 n+1 行:第 n 个学生的姓名 学号 成绩其中姓名和学号均为不超过 10 个字符的字符串,成绩为 0 到 100 之间的一个整数,这里保证在一组测试用例中没有两个学生的成绩原创 2020-08-14 15:51:33 · 295 阅读 · 1 评论 -
数据结构 - 线性表、栈和队列 - 笔记
文章目录1. 线性表1.1 线性表的实现1.1.1 顺序表1.1.2 链表1.1.2.1 单链表1.1.2.2 双链表1.1.2.3 可利用空间表1.1.2.4 字典2. 栈2.1 顺序栈2.2 链式栈2.3 栈的应用2.3.1 栈实现递归2.3.2 栈实现进制转换2.3.3 栈实现平衡符号2.3.4 栈实现逆波兰(RPN)计算器2.3.5 [栈实现迷宫问题的解决](https://blog.cs...原创 2020-06-19 16:15:02 · 110 阅读 · 0 评论 -
数据结构 - 图 - 笔记
目录图的定义、实现与基本操作有关图的重要定义图的两种表示方式、ADT及其实现1.图的定义、实现与基本操作1.1 有关图的重要定义稀疏图,密集图,完全图标号图相邻的,邻接点权,带权图路径,简单路径,路径长度回路,简单回路子图连通的,连通分量(最大连通子图)无环图,有向无环图自由树1.2 图的两种表示方式、ADT及其实现使用哪种方式取决于边的数目密集图...原创 2020-06-19 16:14:04 · 184 阅读 · 0 评论 -
数据结构 - 二叉树 - 笔记
目录定义有关二叉树的重要定义二叉树的ADT遍历二叉树的方式1.定义1.1 有关二叉树的重要定义路径 - 长度 — 祖先 - 子孙深度:从根结点到该结点的路径长度树的高度=最深节点的深度+1结点的层数=深度 (根结点结点层数为0,深度为0)叶节点、内部节点(/分支节点)(定义有争议) 满二叉树:结点若是分支结点,定有两个非空子结点(定义无争议) 完全二叉树:从...原创 2020-06-19 16:13:28 · 322 阅读 · 0 评论 -
7-1 二分查找 (20分)
原题输入n值(1<=n<=1000)、n个非降序排列的整数以及要查找的数x,使用二分查找算法查找x,输出x所在的下标(0~n-1)及比较次数。若x不存在,输出-1和比较次数。输入格式:输入共三行: 第一行是n值; 第二行是n个整数; 第三行是x值。输出格式:输出x所在的下标(0~n-1)及比较次数。若x不存在,输出-1和比较次数。输入样例:41 2 3 41输出样...原创 2020-02-23 12:23:17 · 4876 阅读 · 0 评论 -
栈、队列及其应用 - 实验题
要求1. 完成下面的栈类QStack,使用其中的双队列实现入栈、出栈等基本运算template class QStack : public Stack{private:int maxSize; //栈的容量AQueue QA;AQueue QB; //基于数组实现的队列public:QStack(int size = defaultSize): QA(size), QB(siz...原创 2020-01-10 16:26:51 · 617 阅读 · 0 评论 -
C++static类成员,static类成员函数
https://blog.csdn.net/u014453898/article/details/64124269转载 2019-11-20 19:08:54 · 208 阅读 · 0 评论 -
poj 2376 Cleaning Shifts。。
#include<iostream>#include<cstring>#include<algorithm>using namespace std;int N,T;int main(){ pair<int,int> num[2500]; while(cin>>N>>T){ for(int i=0 ;i&l...原创 2019-07-09 16:41:13 · 101 阅读 · 0 评论