Time：2021-5-11

# Topic 1

Average score

## Input: two lines

The first line is the number of fractions n
The second line is the N fractions separated by spaces

## Output:

Average score after removing the highest and lowest scores

``````#include

float buf[1001];

void fun(int n){
for(int i=0;i``````

# Topic 2

## Input: one line

The first line: 26 lowercase letters separated by spaces, such as B a c e u F G H I J K L M n o p q R S T V W x y z d….. V Y Z R S Q
Second line: a string (uppercase)   For example: buptz

## Output:

Replace B with the second letter of the first line, u with the 21st, P with the (‘a ‘-‘p’ + 1)

``````#include

char buf1[101];
char buf2[101];

int main(){

char c;

while(scanf("%c",&c)!=EOF){
int j=1;
if(c=='\n')scanf("%c",&c);// C will read this symbol at the end of the last big loop
while(c!='\n'){

if(c>='a'&&c<='z'&&j<=26)buf1[j++]=c;
scanf("%c",&c);

}

scanf("%s",buf2);

for(int i=0;buf2[i]!=0;i++){
int t=buf2[i]-'A'+1;
buf2[i]=buf1[t];

}
printf("%s\n",buf2);
}

return 0;
}``````

# Topic 3

sort

## Input: four lines

First line: number N1 (2 3 4 5 6)
The second line: the number of N1, in ascending order (sequence a)
The third line: number N2 (4 5 6 8 9)
The fourth line: the number of N2, in ascending order (sequence b)

## Output: N2 line

2
3
4
5
5
The i-th line is the number of numbers in a that are less than the i-th number of B

``````#include

int a[1001];
int b[1001];

int main(){
int n1,n2;
while(scanf("%d",&n1)!=EOF){
for(int i=0;i``````

# Topic 4

In Huffman coding   Average code length = code length × Probability of codeword occurrence

For example, the occurrence times of ABCDE five characters are 50 20 5 10 15 respectively

Then, the Huffman code is a: 0     B:10     C:1110     D:1111     E:110

The average code length of the Huffman code = (50 * 1 + 20 * 2 + 5 * 4 + 10 * 4 + 15 * 3) / 100 = 1.95

## input

There are multiple sets of inputs, two lines in each

First line: number of characters n

The second line: n numbers separated by spaces, indicating the number of occurrences of each character in the n characters

## output

Output the average code length of the Huffman code, and reserve two decimal places

```5
50 20 5 10 15```

## sample output

`1.95Idea 1`
``````#include
#include
using namespace std;

int main(){
int n;
while(scanf("%d",&n)!=EOF){
priority_queue,greater > Q;

double sum=0;
for(int i=0;i``````

Train of thought 2

``````#include
#include
using namespace std;

struct node{
int h;
bool operator < (const node &a) const {
return h>a.h;
}
};

int main(){
int n;
while(scanf("%d",&n)!=EOF){
priority_queue Q;

double sum=0;
for(int i=0;i``````

## What is “hybrid cloud”?

In this paper, we define the concept of “hybrid cloud”, explain four different cloud deployment models of hybrid cloud, and deeply analyze the industrial trend of hybrid cloud through a series of data and charts. 01 introduction Hybrid cloud is a computing environment that integrates multiple platforms and data centers. Generally speaking, hybrid cloud is […]