![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PTA
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 · 241 阅读 · 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 · 165 阅读 · 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 · 264 阅读 · 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 · 322 阅读 · 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 · 404 阅读 · 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 · 80 阅读 · 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 · 79 阅读 · 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 · 1714 阅读 · 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 · 149 阅读 · 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 · 97 阅读 · 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 · 153 阅读 · 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 · 296 阅读 · 1 评论