- 博客(12)
- 收藏
- 关注
原创 最长回文子串(中心扩展 c++)
自己敲的代码 #include<cstdio> #include<string> #include<iostream> #include<algorithm> using namespace std; int change(string str, int i, int j) { // (1)i == st, j == st; // (2) i ...
2019-10-09 21:52:35 259
原创 【Leetcode】2. 两数相加
第一次标注Leetcode 从今天开始, 以后就开始标注leetcode了, 刷了三个月左右的PTA,不过还没刷完, 但是《算法笔记》和《上机指南》差不多刷完了。PTA剩下的题目, 之后会慢慢来完成。 刚开始刷leetcode, 不同的环境和测试方式,有很多不熟悉的地方, 比如 这一题两数相加, 其中, c++ 构造函数, 很久没有, PTA里面, 多是用 #include头解题, 没有遇到过这类...
2019-10-08 08:16:01 127
原创 1030 Travel Plan (30 分) //Dijkstra练习
题干 A traveler’s map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest pat...
2019-09-27 19:26:48 231 1
原创 1034 Head of a Gang (30 分)
1034 Head of a Gang (30 分) 题干 One way that the police finds the head of a gang is to check people’s phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of...
2019-09-26 17:22:33 155 1
原创 PTA1064 A Complete Binary Search Tree (30 分)关于完美二叉排序树的实现练习
1064 Complete Binary Search Tree (30 分) 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 ...
2019-09-21 22:10:36 152
原创 1056 Mice and Rice (25 分) queue的运用
1056 Mice and Rice (25 分) 题干 Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each...
2019-09-18 09:46:05 156
原创 PTA A1039 Course List for Student (25 分)
1039 Course List for Student (25 分) 题干 Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the registered ...
2019-09-15 11:24:02 130
原创 1023 Have Fun with Numbers (20 分)
1023 Have Fun with Numbers (20 分) 题意 Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which hap...
2019-09-15 09:51:31 84
原创 1017 A除以B (20 分)
1017 A除以B (20 分) 题意 本题要求计算 A/B,其中 A 是不超过 1000 位的正整数,B 是 1 位正整数。你需要输出商数 Q 和余数 R,使得 A=B×Q+R 成立。 输入格式: 输入在一行中依次给出 A 和 B,中间以 1 空格分隔。 输出格式: 在一行中依次输出 Q 和 R,中间以 1 空格分隔。 输入样例: 123456789050987654321 7 输出样例: 1...
2019-09-14 13:23:15 91
原创 PTA A1101 Quick Sort (25 分)
PTA A1101 Quick Sort (25 分) 题目 There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then the elements less tha...
2019-09-13 15:23:03 190
原创 1085 Perfect Sequence (25 分)
1085 A Perfect Sequence (25 分) Given a sequence of positive integers and another positive integer p. The sequence is said to be a perfect sequence if M≤m×p where M and m are the maximum and minimum nu...
2019-09-12 17:13:53 69
原创 PTA 1067 Sort with Swap(0, i) (25 分)
PTA 1067 Sort with Swap(0, i) (25 分) Given any permutation of the numbers {0, 1, 2,…, N−1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is allowed to...
2019-09-12 15:49:47 185
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人