2018/3/2晚11点30分写的程序(C++)】的更多相关文章

程序目标:输入一个字符串,竖向输出该字符串.使用string和动态分配内存机制.代码如下: #include<iostream>#include "stdafx.h"#include<cstring>int main(){ using namespace std; string s= cin.getline; char * a = new char[sizeof(s)]; for (int m = 0;m < sizeof(s);m++) a[m] = s…
考核内容: 写一个程序,可以获取从键盘上输入的的三个数,并能够判断是否可以以这三个数字作为边长来构成一个三角形,如果可以的话,输出此三角形的周长及面积: 答案: #include<stdio.h> #include<math.h> #include<stdlib.h> double b1,b2,b3; double p; bool tool(double b1,double b2,double b3) { if((b1+b2>b3)&&(b1+b3…
07-图5 Saving James Bond - Hard Version   (30分) 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 lan…
Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal sequences. And it is a simple standard routine to print the numbers in level-order. H…
1127 ZigZagging on a Tree (30 分) Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal sequences. And it is a simple standard routine to pr…
1053 Path of Equal Weight(30 分) Given a non-empty tree with root R, and with weight W​i​​ assigned to each tree node T​i​​. 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 no…
Given a non-empty tree with root R, and with weight W​i​​ assigned to each tree node T​i​​. The weight of a path from Rto L is defined to be the sum of the weights of all the nodes along the path from R to any leaf node L. Now given any weighted tree…
5-9 Huffman Codes   (30分) In 1953, David A. Huffman published his paper "A Method for the Construction of Minimum-Redundancy Codes", and hence printed his name in the history of computer science. As a professor who gives the final exam problem o…
A1095 Cars on Campus (30)(30 分) Zhejiang University has 6 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with all the information available, you are supposed to tel…
题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/680 5-18 Hashing - Hard Version   (30分) Given a hash table of size NN, we can define a hash function . Suppose that the linear probing is used to solve collisions, we can easily obtain the status…