数据结构与算法
数据结构与算法
zeroming-
Stay hungry,stay foolish.
展开
-
1005 Spell It Right
1005 Spell It Right (20point(s))Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contains one test case. Each case occupies one line原创 2020-10-10 21:44:06 · 116 阅读 · 0 评论 -
1031 Hello World for U (20point(s))
1031 Hello World for U (20point(s))Given any string of N (≥5) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as:h de ll rlowoThat is, the characters must be printed in the original ord原创 2020-09-19 10:36:30 · 98 阅读 · 0 评论 -
PAT甲级(Advanced Level)----1005
1005 Spell It Right (20point(s))Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contains one test case. Each case occupies one line原创 2020-07-08 20:27:28 · 125 阅读 · 0 评论 -
PAT甲级(Advanced Level)----1001
1001 A+B Format (20point(s))Calculate a+b and output the sum in standard format – that is, the digits must be separated into groups of three by commas (unless there are less than four digits).Input Specification:Each input file contains one test case. E原创 2020-07-07 15:43:01 · 162 阅读 · 0 评论 -
C++STL里面的各种数据结构用法总结
1、C++ vector使用方法1.1 基本操作(1)头文件#include<vector>(2)创建vector对象,vector<int> vec;(3)尾部插入数字:vec.push_back(a);(4)使用下标访问元素,cout<<vec[0]<<endl;记住下标是从0开始的。(5)使用迭代器访问元素.vector<int>::iterator it;for(it=vec.begin();it!=vec.end();it原创 2020-05-09 15:31:55 · 640 阅读 · 0 评论 -
树遍历的应用——树的重建
ALDS1_7_D: Reconstruction of the tree限制时间:1s 内存限制:65536KB 正达率:41.38% 现在有两个节点序列,分别是对同一个二叉树进行前序和中序遍历的结果。请编写一个程序,输出该二叉树按后序遍历的节点序列。输入:第一行输入二叉树的节点数n第二行输入前序遍历的节点编号序列,相邻编号用空格隔开第三行输入中序遍历的节点编号序列,相邻编号用空格隔开输出:在一行输出按后序遍历时的节点编号序列。相邻节点编号用空格隔开限制 1&原创 2020-05-09 10:05:28 · 298 阅读 · 0 评论