- 博客(5)
- 收藏
- 关注
原创 7-10 Saving James Bond - Easy Version (25 分)
This time let us consider the situation in the movie “Live and Let Die” in which James Bond, the world’s most famous spy, was captured by a group of drug dealers. He was sent to a small piece of land at the center of a lake filled with crocodiles. There he
2021-02-11 22:20:47
158
原创 7-5 堆中的路径 (25 分)
05-树7 堆中的路径 (25 分) 将一系列给定数字插入一个初始为空的小顶堆H[]。随后对任意给定的下标i,打印从H[i]到根结点的路径。 输入格式: 每组测试第1行包含2个正整数N和M(≤1000),分别是插入元素的个数、以及需要打印的路径条数。下一行给出区间[-10000, 10000]内的N个要被插入一个初始为空的小顶堆的整数。最后一行给出M个下标。 输出格式: 对输入中给出的每个下标i,在一行中输出从H[i]到根结点的路径上的数据。数字间以1个空格分隔,行末不得有多余空格。 输入样例: 5 3 4
2021-02-06 13:14:27
167
原创 04-树5 Root of AVL Tree (25 分)
04-树5 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
2021-02-04 18:49:18
189
2
原创 c++编程题:你真的搞清楚为啥 while(cin >> n) 能成立了吗?
北大程序设计与算法(三)测验题汇总(2020秋季) 描述 读入两个整数,输出两个整数 ,直到碰到-1 #include using namespace std; class MyCin { // 在此处补充你的代码 // 在此结束补充的代码 }; int main() { MyCin m; int n1,n2; while( m >> n1 >> n2) cout << n1 << " " << n2 << endl; return
2020-10-10 00:11:49
1501
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人