[] Data structure and algorithm study notes - "algorithm notes" -8

Sequence

select

Sort
learning the most common select hey Hush, high complexity of O (n- 2 )
Example:

Insertion Sort

Learn the most intuitive direct insertion sort
example:

Application of the sort function

Recommended direct use of C language or C ++ library functions qsort in the sort function to write code
Sort function is header <algorithm>
Its use must be added

#include<algorithm>
using namespace std;

Function format is as follows:

sort(首元素地址(必填),尾元素地址的下一个地址(必填),比较函数(非必填));

If you do not write the comparison function, the default range given previously carried out onAscending.
May be ordered int / float / char data type and other types
Example:

#include <cstdio>
#include <algorithm>
using namespace std;


int main()
{
	int a[6] = { 9,4,2,5,6,-1 };//从小到大排序a[0]到a[3]
	sort(a, a + 4);
	for (int i = 0; i < 6; i++)
	{
		printf("%d ", a[i]);
	}
	printf("\n");
	//从小到大排序a[0]到a[5]
	sort(a, a + 6);
	for (int i = 0; i < 6; i++)
	{
		printf("%d ", a[i]);
	}
	return 0;
}

How to implement the comparison function CMP

optional third parameter is the sort function compare function (typically a function of writing cmp), a human does not have to develop the relationship between the size and the type of comparison rules Comparative comparable structures and the like.
Learns the basic data types, the type of structure, the STL container cmp rule ordering a custom written:

  1. Sorting basic data type of the array
    if cmp not fill, the default is small to large, I want to achieve descending order, you need to use cmp "tell" when switching element sort
    example:
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

bool cmp(int a, int b) {
	return a > b;//理解为当a>b时把a放在b前面
}

int main()
{
	int a[6] = { 9,4,2,5,6,-1 };
	sort(a, a + 6,cmp);
	for (int i = 0; i < 6; i++)
	{
		printf("%d ", a[i]);
	}
	return 0;
}
  1. Sorting array of structures
    It defines the following structure:
struct node {
	int x, y;
}ssd[10];

1). A Sort
if you want to ssd array sorted by descending x can be written cmp function

bool cmp(node a, node b) {
	return a.x > b.x;//理解为当a>b时把a放在b前面
}

Example:

#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

struct node {
	int x, y;
}ssd[10];

bool cmp(node a, node b) {
	return a.x > b.x;//理解为当a>b时把a放在b前面
}

int main()
{
	ssd[0].x = 2;
	ssd[0].y = 2;
	ssd[1].x = 1;
	ssd[1].y = 3;
	ssd[2].x = 3;
	ssd[2].y = 1;
	sort(ssd, ssd + 3,cmp);
	for (int i = 0; i < 3; i++)
	{
		printf("%d %d\n", ssd[i].x,ssd[i].y);
	}
	return 0;
}

Output:

3 1
2 2
1 3
请按任意键继续. . .

2).Two sorting
X descending order according to the first, but when x is equal to the case where, in the y-small to large, then set cmp:

bool cmp(node a, node b) {
	if (a.x != b.x)
		return a.x > b.x;
	else
		return a.y < b.y;
}

Example:

#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

struct node {
	int x, y;
}ssd[10];

bool cmp(node a, node b) {
	if (a.x != b.x)
		return a.x > b.x;
	else
		return a.y < b.y;
}

int main()
{
	ssd[0].x = 2;
	ssd[0].y = 2;
	ssd[1].x = 1;
	ssd[1].y = 3;
	ssd[2].x = 2;
	ssd[2].y = 1;
	sort(ssd, ssd + 3,cmp);
	for (int i = 0; i < 3; i++)
	{
		printf("%d %d\n", ssd[i].x,ssd[i].y);
	}
	return 0;
}

Output:

2 1
2 2
1 3
请按任意键继续. . .
  1. Sort the container
    in an STL standard containers,Only vector, string, deque is a sort ofThis is because the image set, map such containers is to achieve red-black tree, ordered element itself, it is not allowed to use the sort order.
    For example to vector
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

struct node {
	int x, y;
}ssd[10];

bool cmp(int a, int b) {
	return a > b;//由于vector中的元素为int型,因此仍然是Int的比较
}

int main()
{
	vector<int> vi;
	vi.push_back(3);
	vi.push_back(1);
	vi.push_back(2);
	sort(vi.begin(), vi.end(), cmp);//对整个vector排序
	for (int i = 0; i < 3; i++)
	{
		printf("%d ", vi[i]);
	}
	return 0;
}

Output:

3 2 1 请按任意键继续. . .

Look sort of string:

#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

int main()
{
	string str[3] = { "bbbb","cc","aaa" };
	sort(str, str + 3);//将string型数组按字典序从小到大输出
	for (int i = 0; i < 3; i++)
	{
		//printf("%s \n",str[i]);//注意这里不能用printf,至于为什么,目前还不知道==
		cout << str[i] << endl;
	}
	return 0;
}

Note that can not use printf, as to why it is not known
Output:

aaa
bbbb
cc
请按任意键继续. . .

If you want to replace from small to large, for the

#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

bool cmp(string str1,string str2) {
	return str1.length() < str2.length();
}

int main()
{
	string str[3] = { "bbbb","cc","aaa" };
	sort(str, str + 3,cmp);//将string型数组按字典序从小到大输出
	for (int i = 0; i < 3; i++)
	{
		//printf("%s \n",str[i]);//注意这里不能用printf,至于为什么,目前还不知道==
		cout << str[i] << endl;
	}
	return 0;
}

Output:

cc
aaa
bbbb
请按任意键继续. . .

Students achieve ranking

Students' individual ranking rules: different different scores rankings, occupying the same but a fraction of the same rank to rank, there are two ways to calculate the ranking :( array sort after)

  1. If the current score is equal to the individual on an individual score on a ranking equal rank, or rank equal to the array index + 1;
  2. If the title does not have to really record rankings as long as the output: Let the initial value of int type variable r is 1, then traverse all individual, if the individual is not the first individual current and the current individual's score is not equal to the last individual score, r is equal to the array table is incremented by one. This practice applies to require too much information output, the first method results in the case of long codes.
    Example:
    n-examination room, and ticket number are given fraction of each of the candidates in the examination room, it requires all candidates by score in descending order, and sequentially outputs all candidates ticket number, ranking, and ranking numbers examination examination room;
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

struct student {
	long long  number;
	int score;
	int num;
	int rank0;
	int rank1;
}stu[100];

bool cmp(student a,student b) {
	if (a.score == b.score)
		return a.number < b.number;
	else
		return a.score > b.score;
}

//n个考场,给出各考场中考生的准考证号和分数,
//要求所有考生按分数从高到低排序,
//并按顺序输出所有考生的准考证号、排名、考场号以及考场内排名;

int main()
{
	int total = 0;//考场学生数
	int alltotal = 0;//学生总数
	int n;//考场数
	int k = 0;//学生数组号
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		int temp = k;
		scanf("%d", &total);
		for (int j = 0; j < total; j++)
		{
			scanf("%lld%d", &stu[k].number, &stu[k].score);
			stu[k].num = i + 1;
			k++;
		}
		alltotal += total;
		sort(stu + temp, stu + temp + total + 1, cmp);
		stu[temp].rank0 = 1;
		for (int j = temp+1; j < total+temp; j++)
		{
			if (stu[j].score == stu[j - 1].score)
			{
				stu[j].rank0 = stu[j - 1].rank0;
			}
			else
			{
				stu[j].rank0 = j-temp + 1;
			}
		}
	}
	printf("%d\n", alltotal);
	sort(stu, stu + alltotal+1,cmp);
	stu[0].rank1 = 1;
	printf("%lld %d %d %d\n", stu[0].number, stu[0].rank1, stu[0].num, stu[0].rank0);
	for (int j = 1; j < alltotal; j++)
	{
		if (stu[j].score == stu[j - 1].score)
		{
			stu[j].rank1 = stu[j - 1].rank1;
		}
		else
		{
			stu[j].rank1 = j + 1;
		}
		printf("%lld %d %d %d\n", stu[j].number, stu[j].rank1, stu[j].num, stu[j].rank0);
	}
	return 0;
}

Input:

2
5
8888001 95
8888005 100
8888003 95
8888002 77
8888004 85
4
8888013 65
8888011 25
8888014 100
8888012 85

Export

2
5
8888001 95
8888005 100
8888003 95
8888002 77
8888004 85
4
8888013 65
8888011 25
8888014 100
8888012 85

Textbook Code Example:

#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

struct student {
	char id[15];//准考证号
	int score;//分数
	int location_number;//考场号
	int location_rank;//考场内排名
}stu[100];

bool cmp(student a,student b) {
	if (a.score != b.score)
		return a.score > b.score;
	else
		return strcmp(a.id,b.id)<0;
}

//n个考场,给出各考场中考生的准考证号和分数,
//要求所有考生按分数从高到低排序,
//并按顺序输出所有考生的准考证号、排名、考场号以及考场内排名;

int main()
{
	int k, num = 0;//num为学生总数
	int n;//考场数
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &k);//该考场内人数
		for (int j = 0; j < k; j++)
		{
			scanf("%s%d", &stu[num].id, &stu[num].score);
			stu[num].location_number = i ;
			num++;
		}
		sort(stu + num-k, stu + num, cmp);
		stu[num-k].location_rank = 1;
		for (int j = num-k+1; j < num; j++)
		{
			if (stu[j].score == stu[j - 1].score)
			{
				stu[j].location_rank = stu[j - 1].location_rank;
			}
			else
			{
				stu[j].location_rank = j-(num-k) + 1;
			}
		}
	}
	printf("%d\n", num);
	sort(stu, stu + num,cmp);
	int r = 1;
	for (int j = 0; j < num; j++)
	{
		if (j>0&&stu[j].score != stu[j - 1].score)
		{
			r = j + 1;
			//stu[j].rank1 = stu[j - 1].rank1;
		}
		printf("%s %d %d %d\n", stu[j].id, r, stu[j].location_number, stu[j].location_rank);
	}
	return 0;
}

Can learn that:

  1. Cmp function of design, when he learned the number is set to an array of characters, it should be designed
    return strcmp(a.id,b.id)<0;
  2. The total number of students is increasing, the number of bits equal to the start of each examination room in real time (this time you finish entering all this exam student information) minus the total number of students in the examination room, the last one for the total number of students at this time;
  3. This uses the second method described earlier rankings, I used before is the first method, the second method is clearly more concise.

exercise

Sequence

Description Title
of the number n of inputs and outputs sort.
Input
of the first input line comprises an integer n (1 <= n <= 100). The next line comprises n integers.
Output
may be multiple sets of test data for each set of data, the n integers sorted output, has a space behind each number.
Each set of test data per line.

#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

int main()
{
	int n;
	int input[110];
	while (scanf("%d", &n)!=EOF)
	{
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &input[i]);
		}
		sort(input, input + n);//这里到底要不要+1?
		for (int i = 0; i < n; i++)
		{
			printf("%d", input[i]);
			if (i != n)
			{
				printf(" ");
			}
		}
		printf("\n");
	}
	return 0;
}

There is a problem,

	sort(input, input + n);

In the end or not +1 here?
Not a plus! Since the input can be as input + 0,
the post as an Input + (n-1) +1
special ordering

Description Title
enter a series of integers, wherein the maximum number of pick, and the remaining number of sort.
Input
input of the first row comprises an integer N, 1 <= N <= 1000, representative of the number of the input data.
The next line of N integers.
Output
may be multiple sets of test data for each set of data,
a first output line an integer representing the maximum value of N integers, and the value is removed from the array, the number of remaining sort.
The output of the second line ordering.

#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

int main()
{
	int n;
	int input[1100];
	while (scanf("%d", &n)!=EOF)
	{
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &input[i]);
		}
		if (n == 1)
		{
			printf("%d\n-1\n", input[0]);
		}
		else 
		{			
			sort(input, input + n);
			printf("%d\n", input[n - 1]);
			input[n - 1] = '\0';
			for (int i = 0; i < n - 1; i++)
			{
				printf("%d", input[i]);
				if (i < n-2)
				{
					printf(" ");
				}
			}
			printf("\n");
		}
	}
	return 0;
}

Sort EXCEL

Title Description
Excel can specify the column to sort by any of a group of records. Now you write a program to achieve similar functionality.
For each test case, a first output line "Case i:", where i is the test number (starting from 1). Then outputs the N rows in the result of required sorting, namely: when C = 1, sorted in ascending student number; when C = 2, according to the names of non-decreasing lexicographic ordering; when C = 3, the press performance non-descending order. When the number of students with the same name or the same results, press their student number in ascending order.
Enter the
test input contains several test cases. Each row of the first test case contains two integers N (N <= 100000) and C, where N is the number of records, C is the column number of the specified sort. Here are N lines, each containing a student record. Each record of school student number (6 digits, with no duplicate set of test student number), name (no more than eight and not a string without spaces), score (closed interval [, 1000] integer in ), separated by a space between each item. When N = 0 to read, the all of the input end, an output not corresponding results.
Output
for each test case, a first output line "Case i:", where i is the test number (starting from 1). Then outputs the N rows in the result of required sorting, namely: when C = 1, sorted in ascending student number; when C = 2, according to the names of non-decreasing lexicographic ordering; when C = 3, the press performance non-descending order. When the number of students with the same name or the same results, press their student number in ascending order.

#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <iostream>
using namespace std;

struct student {
	char id[10];
	char name[10];
	int score;
}stu[100010];

bool cmp1(student a, student b)
{
	return strcmp(a.id, b.id)<0;
}

bool cmp2(student a, student b)
{
	if (!strcmp(a.name, b.name))
		return strcmp(a.id, b.id) < 0;
	else
		return strcmp(a.name, b.name) < 0;
}

bool cmp3(student a, student b)
{
	if (a.score != b.score)
		return a.score<b.score;
	else
		return strcmp(a.id, b.id)<0;
}

int main()
{
	int n,c;
	int nn = 1;
	while (scanf("%d%d", &n, &c), n)
	{
		for (int i = 0; i < n; i++)
		{
			scanf("%s%s%d", stu[i].id, stu[i].name, &stu[i].score);
		}
		switch (c)
		{
		case 1:
		{
			//sort(stu->id, (stu + n)->id);//结构体比较能不能这样偷懒?答:做梦。
			sort(stu, stu + n, cmp1);
			break;
		}
		case 2:
		{
			sort(stu, stu + n, cmp2);
			break;
		}
		case 3:
		{
			sort(stu, stu + n, cmp3);
			break;
		}
		default:
			break;
		}
		printf("Case %d:\n",nn);
		for (int i = 0; i < n; i++)
		{
			printf("%s %s %d\n", stu[i].id, stu[i].name, stu[i].score);
		}
		nn++;
	}
	return 0;
}

case 1:
{
//sort(stu->id, (stu + n)->id);//Comparison of the structure can not be so lazy? Answer: dreaming.
sort(stu, stu + n, cmp1);
break;
}

Sorting inside a string

Description Title
enter a string of 200 or less, then the output character string is sorted in ascending order.
Input
test data a plurality of sets, the input string.
Output
for each set of input, output the processed result.

#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <iostream>
using namespace std;
int main()
{
	char str[210];
	int len;
	while (fgets(str, 210, stdin) != NULL)
	{
		len = strlen(str);
		sort(str, str + len-1);
		str[len-1] = '\0';
		puts(str);
	}
	return 0;
}

Because the format has been the problem can not AC (not clear from the title), no longer tangled problem.
Problem B

Title Description
writing a program that, for an m rows and m columns (1 <m <10) is square, each seeking the row, and each column of elements of the main diagonal and, finally sequentially in descending order output.
Input
common set of data, the first input acts a positive integer, m represents, the next line m, m represents an integer of matrix elements of each row.
Output
descending integer line arrangement, each integer followed by a space, the last wrap.

#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <iostream>
using namespace std;

bool cmp(int a, int b)
{
	return a > b;
}

int main()
{
	int num[10][10];
	int m;
	int sum[22];
	while (scanf("%d", &m) != EOF)
	{
		int sumi[10] = {}, sumj[10] = {}, sumx[2] = {};
		for (int i = 0; i < m; i++)
		{
			for (int j = 0; j < m; j++)
			{
				scanf("%d", &num[i][j]);
				sumi[i] += num[i][j];
				//if (j == m-1)
				//	getchar();
			}
		}
		for (int j = 0; j < m; j++)
		{
			for (int i = 0; i < m; i++)
				sumj[j] += num[i][j];
		}
		for (int x = 0; x < m; x++)
		{
			sumx[0] += num[x][x];
			sumx[1] += num[x][m - x - 1];
		}
		int p = 0;
		for (int i = 0; i < m; i++)
		{
			sum[p] = sumi[i];
			p++;
		}
		for (int j = 0; j < m; j++)
		{
			sum[p] = sumj[j];
			p++;
		}
		for (int x = 0; x < 2; x++)
		{
			sum[p] = sumx[x];
			p++;
		}
		sort(sum, sum + 2 * m + 2, cmp);
		for (int p = 0; p < 2 * m + 2; p++)
		{
			printf("%d", sum[p]);
			if (p != 2 * m + 1)
				printf(" ");
		}
		printf("\n");
	}
	return 0;
}

Mice queue

Description Title
N white mice (1 <= N <= 100 ), each rat head was a colored hat. Now the rats weighed each required output color thereof hat head descending order according to the weight of the rats. Hat color is represented by "red", "blue" and other strings. Different mice can wear the same color hat. The weight of the mice as an integer.
Input
Multi-input case, the input of each case conduct a first integer N, the number of mice.
Here there are N rows, each row is an information albino rats. The first is a positive integer of not greater than 100, represents the weight of the rats,; the second string, representing the color of the hat rats, a string of no more than 10 characters.
Note: The weight of the rats varied.
Output
each case output color cap according to the weight of mice of mice descending order.

#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <iostream>
using namespace std;

struct mouse {
	int weight;
	char color[15];
}mou[110];

bool cmp(mouse a, mouse b)
{
	return a.weight > b.weight;
}

int main()
{
	int N;

	while (scanf("%d", &N) != EOF)
	{
		for (int i = 0; i < N; i++)
		{
			scanf("%d %s", &mou[i].weight, mou[i].color);//这里可不可以没有空格?
		}
		sort(mou, mou + N, cmp);
		for (int i = 0; i < N; i++)
		{
			printf("%s\n", mou[i].color);
		}
	}
	return 0;
}

for (int i = 0; i < N; i++)
{
scanf("%d %s", &mou[i].weight, mou[i].color);// Can not have space here? A: Yes.
}

Median

Title Description
Median define: a set of data in ascending order of the arrangement, in a number of (or average most two intermediate data) of the intermediate position.
Given a set of random integers, median is obtained number, if the required average of the two numbers among the most, can be rounded down (without using floating point)
input
to the test program comprises a plurality of sets of data, each set of the first row of test data N, the representative of the set of test the number of data included, 1 <= N <= 10000 .
then the input data of N behavioral N, N 0 = end of the input
output
output bits, each set of test data output line

#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <iostream>
using namespace std;

int main()
{
	int n;
	int	num[10010];
	int temp;
	while (scanf("%d", &n), n)
	{
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &num[i]);
		}
		sort(num, num + n);
		if (n % 2)
			printf("%d\n", num[(n - 1) / 2]);
		else
		{
			temp = (num[n / 2] + num[n / 2 - 1])/2 ;
			printf("%d\n", temp);
		}
	}
}

Integer sort of parity

Description Title
input integer 10, separated from each other by spaces. Reordering an output (separated by spaces) after requirements:
1. The first output of odd numbers, press in descending order;
2 and wherein the even and press ascending order.
Enter
any sort of 10 integers (0 to 100), separated from each other by spaces.
Output
may be multiple sets of test data for each set of data, in accordance with the requirements of the sorted output, separated by a space.
Tips
multiple sets of data, pay attention to the output format
1. The test data may be many groups, use while (cin >> a [0] >> a [1] >> ... >> a [9]) similar approach to achieve;
2. random input data, possibly equal.

#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <iostream>
using namespace std;

bool cmp(int a, int b)
{
	return a > b;
}

int main()
{
	int a[10];//10还是11?
	int a0[10], a1[10];
	while (cin>> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5] >> a[6] >> a[7] >> a[8] >> a[9])
	{
		int p = 0, q = 0;
		for (int i = 0; i < 10; i++)
		{
			if (a[i] % 2)
			{
				a1[p] = a[i];
				p++;
			}
			else
			{
				a0[q] = a[i];
				q++;
			}
		}
		sort(a1, a1 + p, cmp);
		sort(a0, a0 + q);
		for (int i = 0; i < p; i++)
			printf("%d ", a1[i]);
		for (int i = 0; i < q; i++)
		{
			printf("%d", a0[i]);
			if (i != q - 1)
				printf(" ");
		}
		printf("\n");
	}
	return 0;
}

** Ranking **

Title Description
Today's examination on although there are real-time Ranklist, but only the top ranked according to the number of issues to sort completed, without considering the score for each question, it is not the final rankings. Given admission, you write a program to find the final score by the candidates, and their performance print in descending order.
Input
Test input field contains information about a number of exams. Examination first information line per field gives the number of candidates N (0 <N <1000) , exam number M (0 <M <= 10 ), the score line (positive integer) G; the second line sorting is given to the first question positive integer value of m question; the N rows, each row is given a ticket number of candidates (the string length does not exceed 20), the total number m sOLVING subject, title, and number of questions that m (subject number from 1 to M).
When the number of candidates read as 0, the input end of the exam not be processed.
Output
for each test, the number of candidates in the first row of the first line of the fractional output of not less than n, then n row by score in descending output on the score line candidate number candidates, separated by a space therebetween. Over the same as if the candidates scores, output in ascending order of their candidate number.

#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <iostream>
using namespace std;

struct student {
	char id[25];
	int n;
	int m[10];
	int score=0;//是不是这样初始化的?
}stu[1010];

bool cmp(student a, student b)
{
	if (a.score == b.score)
		return a.id < b.id;
	else
		return a.score > b.score;
}

int main()
{
	int N, M, G;
	int value[10] = {};
	int sum=0;
	student output[1000];
	while (scanf("%d%d%d", &N, &M, &G), N)
	{
		for (int i = 0; i < M; i++)
		{
			scanf("%d", &value[i]);
		}
		for (int i = 0; i < N; i++)
		{
			scanf("%s%d", stu[i].id,&stu[i].n);
			for (int j = 0; j < stu[i].n; j++)
			{
				scanf("%d", &stu[i].m[j]);
				stu[i].score += value[stu[i].m[j]-1];
			}
		}
		for (int i = 0; i < N; i++)
		{
			if (stu[i].score >= G)
			{
				output[sum] = stu[i];//能不能直接复制?
				sum++;
			}
		}
		sort(output, output + sum, cmp);
		printf("%d\n", sum);
		for (int i = 0; i < sum; i++)
		{
			printf("%s %d\n", output[i].id, output[i].score);
		}
	}
	return 0;
}
Published 43 original articles · won praise 4 · Views 1219

Guess you like

Origin blog.csdn.net/weixin_42176221/article/details/100998916