飞道的博客

二分法练习题总结(不容错过的经典好题!!!)

214人阅读  评论(0)

A题

来源:http://codeforces.com/problemset/problem/4/C

A new e-mail service “Berlandesk” is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that’s why they ask you to help. You’re suggested to implement the prototype of site registration system. The system should work on the following principle.

Each time a new user wants to register, he sends to the system a request with his name. If such a name does not exist in the system database, it is inserted into the database, and the user gets the response OK, confirming the successful registration. If the name already exists in the system database, the system makes up a new user name, sends it to the user as a prompt and also inserts the prompt into the database. The new name is formed by the following rule. Numbers, starting with 1, are appended one after another to name (name1, name2, …), among these numbers the least i is found so that name i does not yet exist in the database.

Input
The first line contains number n (1 ≤ n ≤ 105). The following n lines contain the requests to the system. Each request is a non-empty line, and consists of not more than 32 characters, which are all lowercase Latin letters.

Output
Print n lines, which are system responses to the requests: OK in case of successful registration, or a prompt with a new name, if the requested name is already taken.

Examples
Input
4
abacaba
acaba
abacaba
acab

Output
OK
OK
abacaba1
OK

Input
6
first
first
second
second
third
third

Output
OK
first1
OK
second1
OK
third1

题意:
题意不算难懂,就是一个用户注册系统,如果输入的用户名没出现过就输出“OK”,如果出现过 i 次,就在用户名的后边添上数字 i

思路:
虽然这是二分的练习题,但是我真没想出来咋用二分的方法做,不符合二分的特点啊…,暴力写了一个,结果超时了

暴力枚举 】(超时)

#include<iostream>
#include<cstring>
using namespace std;
const int N = 1e5 + 10;
string a[N];
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	for (int i = 1; i <= n; i++)
	{
		int k = 0;
		for (int j = 1; j < i; j++)
			if (a[i] == a[j])
				k++;
		if (k == 0)
			cout << "OK" << endl;
		else
			cout << a[i] << k << endl;
	}
	return 0;
}

然后就从别的角度看这个题,结果发现发现用STL的中的map就能非常简单的解决这个问题。

【map】(AC)

#include<iostream>
#include<map>
#include<string>
using namespace std;
int main()
{
	map<string, int> m;
	string s;
	int n;
	cin >> n;
	while (n--)
	{
		cin >> s;
		m[s]++;
		if (m[s] > 1)
			cout << s << m[s] - 1 << endl;
		else
			cout << "OK" << endl;
	}
	return 0;
}

B题

来源:http://codeforces.com/contest/230/problem/C

You are given a table consisting of n rows and m columns. Each cell of the table contains a number, 0 or 1. In one move we can choose some row of the table and cyclically shift its values either one cell to the left, or one cell to the right.

To cyclically shift a table row one cell to the right means to move the value of each cell, except for the last one, to the right neighboring cell, and to move the value of the last cell to the first cell. A cyclical shift of a row to the left is performed similarly, but in the other direction. For example, if we cyclically shift a row “00110” one cell to the right, we get a row “00011”, but if we shift a row “00110” one cell to the left, we get a row “01100”.

Determine the minimum number of moves needed to make some table column consist only of numbers 1.

Input
The first line contains two space-separated integers: n (1 ≤ n ≤ 100) — the number of rows in the table and m (1 ≤ m ≤ 104) — the number of columns in the table. Then n lines follow, each of them contains m characters “0” or “1”: the j-th character of the i-th line describes the contents of the cell in the i-th row and in the j-th column of the table.

It is guaranteed that the description of the table contains no other characters besides “0” and “1”.

Output
Print a single number: the minimum number of moves needed to get only numbers 1 in some column of the table. If this is impossible, print -1.

Examples
Input
3 6
101010
000100
100000
Output
3

Input
2 3
111
000
Output
-1

Note
In the first sample one way to achieve the goal with the least number of moves is as follows: cyclically shift the second row to the right once, then shift the third row to the left twice. Then the table column before the last one will contain only 1s.

In the second sample one can’t shift the rows to get a column containing only 1s.

题意:
给你一个N*M的表格,每个格子里的数字为0或1,可以选中某一行进行向左或者向右移动。移动规则:

  • 将某一行向右移动一个单元格意味着将每个单元格(最后一个单元格除外)的值移动到右边相邻的单元格,并将最后一个单元格的值移动到第一个单元格。
  • 行向左的移动的执行方式类似,但方向相反。

问最少需要多少步,可以将某一列都变成1。

思路:
这题也是这样,虽然是二分专场,但是还是不知道哪里要用二分…
对于每列计算把每一行中与此列最近的1移到此列的距离之和,然后取得最小值。
当然最近的1必然出现在以此列为中心线的左边或者右边(当然也包括在中心线上的)。当中心线靠右,写后面没有1了,那么它右边的1就应该是此行中最左边的1(移动就是一个环),同样当中心线靠左,且其左边没有1了,那么此时应当纳入计算的就应该是此行中最右边的那个一,我们就可以在最左边和最右边加上额外的两个1。
代码

#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include<algorithm>
using namespace std;
const int N = 1e4 + 10;
int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    string a;
    int sum[N];
    memset(sum, 0, sizeof(sum));
    int ans = 0x3f3f3f3f;
    int tmp[N];
    int flag = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        if (flag) 
            continue;
        int s = 1;
        for (int j = 0; j < a.size(); j++)
        {
            if (a[j] == '1')
                tmp[s++] = j;
        }
        if (s == 1)//此行中没有一
        {
            flag = 1;
            continue;
        }
        tmp[0] = tmp[s - 1] - m;//在左边加上最右边的那个一
        tmp[s] = tmp[1] + m;//在右边加上最左边的那个一
        int ans = 0, l, r;
        for (int j = 0; j < m; j++)
        {
            r = j - tmp[ans];
            l = tmp[ans + 1] - j;
            if (l == 0)//如果两个参考的1中,靠右的那个一就在线上,那么为了使得下一次可以继续用两个1将参考列夹在中间,那么应该是的ans++
                ans++;
            sum[j] += min(l, r);
        }
    }
    if (flag)
        cout<<"-1";
    else
    {
        for (int i = 0; i < m; i++)
            ans = min(ans, sum[i]);
        printf("%d\n", ans);
    }
    return 0;
}

E题

The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C x D are such that a + b + c + d = 0 . In the following, we assume that all lists have the same size n .

Input
The first line of the input file contains the size of the lists n (this value can be as large as 4000). We then have n lines containing four integer values (with absolute value as large as 2 28 ) that belong respectively to A, B, C and D .

Output
For each input file, your program has to write the number quadruplets whose sum is zero.

Sample Input
6
-45 22 42 -16
-41 -27 56 30
-36 53 -37 77
-36 30 -75 -46
26 -38 -10 62
-32 -54 -6 45
Sample Output
5

Hint
Sample Explanation: Indeed, the sum of the five following quadruplets is zero: (-45, -27, 42, 30), (26, 30, -10, -46), (-32, 22, 56, -46),(-32, 30, -75, 77), (-32, -54, 56, 30).

题意:
给你一些数,每行4个,从每列里选一个数,让这四个数的和为0,问有多少种取法

思路:
先分别求出前两列后两列的所有的和,然后对后两列的和进行排序,对后两列进行二分查找看有多少种情况即可,枚举会超时

代码实现:

#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int a[4002][4], sum1[16000002], sum2[16000002];
int main()
{
    int n, mid;
    while (cin>>n)
    {
        for (int i = 0; i < n; i++)
        {
            scanf("%d%d%d%d", &a[i][0], &a[i][1], &a[i][2], &a[i][3]);
        }
        int k = 0;
        int m = 0;
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
            {
                sum1[k++] = a[i][0] + a[j][1];
                sum2[m++] = a[i][2] + a[j][3];
            }
        sort(sum2, sum2 + k);
        int cnt = 0;
        for (int i = 0; i < k; i++)
        {
            int left = 0;
            int right = k - 1;
            while (left <= right)
            {
                mid = (left + right) / 2;
                if (sum1[i] + sum2[mid] == 0)
                {
                    cnt++;
                    for (int j = mid + 1; j < k; j++)
                    {
                        if (sum1[i] + sum2[j] != 0)
                            break;
                        else
                            cnt++;
                    }
                    for (int j = mid - 1; j >= 0; j--)
                    {
                        if (sum1[i] + sum2[j] != 0)
                            break;
                        else
                            cnt++;
                    }
                    break;
                }
                if (sum1[i] + sum2[mid] < 0)
                    left = mid + 1;
                else
                    right = mid - 1;
            }
        }
        printf("%d\n", cnt);
    }
    return 0;
}

F题

Given N numbers, X1, X2, … , XN, let us calculate the difference of every pair of numbers: ∣Xi - Xj∣ (1 ≤ i < j ≤ N). We can get C(N,2) differences through this work, and now your task is to find the median of the differences as quickly as you can!

Note in this problem, the median is defined as the (m/2)-th smallest number if m,the amount of the differences, is even. For example, you have to find the third smallest one in the case of m = 6.

Input
The input consists of several test cases.
In each test case, N will be given in the first line. Then N numbers are given, representing X1, X2, … , XN, ( Xi ≤ 1,000,000,000 3 ≤ N ≤ 1,00,000 )

Output
For each test case, output the median in a separate line.

Sample Input
4
1 3 2 4
3
1 10 2
Sample Output
1
8

题意:
题意比较好理解,就是一个数组每两个数相减取绝对值,求所有绝对值组成的数组的中数

思路:
使用了二分的方法,直接暴力解决会超时,判断小于等于mid的数是否大于所有绝对值个数的一半,这里用了STL中的upper_bound函数
参考博客:upper_bound函数资料

代码

#include<iostream>
#include<algorithm>
#include<cstdio>
#define ll long long
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn];
int n, m;


bool check(int x)
{
    int sum = 0;
    for (int i = 0; i < n - 1; i++)
    {
        int p = upper_bound(a, a + n, a[i] + x) - a;
        sum += p - i - 1;
    }
    return sum >= (m + 1) / 2;
}

int main()
{
    while (cin >> n)
    {
        for (int i = 0; i < n; i++)
            scanf("%d", &a[i]);
        sort(a, a + n);
        m = n * (n - 1) / 2;
        int l = 0, r = a[n - 1] - a[0], ans = (l + r) / 2;
        while (l <= r)
        {
            int mid = (l + r) / 2;
            if (check(mid)) ans = mid, r = mid - 1;
            else l = mid + 1;
        }
        cout << ans << endl;
    }
    return 0;
}

G题

Inhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize the most honest contest ever. It was decided to connect computers for the contestants using a “star” topology - i.e. connect them all to a single central hub. To organize a truly honest contest, the Head of the Judging Committee has decreed to place all contestants evenly around the hub on an equal distance from it.
To buy network cables, the Judging Committee has contacted a local network solutions provider with a request to sell for them a specified number of cables with equal lengths. The Judging Committee wants the cables to be as long as possible to sit contestants as far from each other as possible.
The Cable Master of the company was assigned to the task. He knows the length of each cable in the stock up to a centimeter,and he can cut them with a centimeter precision being told the length of the pieces he must cut. However, this time, the length is not known and the Cable Master is completely puzzled.
You are to help the Cable Master, by writing a program that will determine the maximal possible length of a cable piece that can be cut from the cables in the stock, to get the specified number of pieces.

Input
The first line of the input file contains two integer numb ers N and K, separated by a space. N (1 = N = 10000) is the number of cables in the stock, and K (1 = K = 10000) is the number of requested pieces. The first line is followed by N lines with one number per line, that specify the length of each cable in the stock in meters. All cables are at least 1 meter and at most 100 kilometers in length. All lengths in the input file are written with a centimeter precision, with exactly two digits after a decimal point.

Output
Write to the output file the maximal length (in meters) of the pieces that Cable Master may cut from the cables in the stock to get the requested number of pieces. The number must be written with a centimeter precision, with exactly two digits after a decimal point.
If it is not possible to cut the requested number of pieces each one being at least one centimeter long, then the output file must contain the single number “0.00” (without quotes).

Sample Input
4 11
8.02
7.43
4.57
5.39
Sample Output
2.00
题意:
有n段长度分别为Li的电缆,要求把它们分割成K条长度为X的电缆,问X的最大值为多少。

题解:
将X视为变量,可知它的范围为0~max; 那么问题就变成了电缆长度取X时,所得的电缆条数大于,还是等于,或小于K的问题。 用二分查找法能很快的找出K的值,不过要注意向下取整。
代码

#include<iostream>
#include<algorithm>
#include<cstdio>
#define ll long long
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn];
int n, m;


bool check(int x)
{
    int sum = 0;
    for (int i = 0; i < n - 1; i++)
    {
        int p = upper_bound(a, a + n, a[i] + x) - a;
        sum += p - i - 1;
    }
    return sum >= (m + 1) / 2;
}

int main()
{
    while (cin >> n)
    {
        for (int i = 0; i < n; i++)
            scanf("%d", &a[i]);
        sort(a, a + n);
        m = n * (n - 1) / 2;
        int l = 0, r = a[n - 1] - a[0], ans = (l + r) / 2;
        while (l <= r)
        {
            int mid = (l + r) / 2;
            if (check(mid)) ans = mid, r = mid - 1;
            else l = mid + 1;
        }
        cout << ans << endl;
    }
    return 0;
}

H题

Farmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the exact amount of money (1 ≤ moneyi ≤ 10,000) that he will need to spend each day over the next N (1 ≤ N ≤ 100,000) days.

FJ wants to create a budget for a sequential set of exactly M (1 ≤ M ≤ N) fiscal periods called “fajomonths”. Each of these fajomonths contains a set of 1 or more consecutive days. Every day is contained in exactly one fajomonth.

FJ’s goal is to arrange the fajomonths so as to minimize the expenses of the fajomonth with the highest spending and thus determine his monthly spending limit.

Input
Line 1: Two space-separated integers: N and M
Lines 2… N+1: Line i+1 contains the number of dollars Farmer John spends on the ith day
Output
Line 1: The smallest possible monthly limit Farmer John can afford to live with.
Sample Input
7 5
100
400
300
100
500
101
400
Sample Output
500
Hint
If Farmer John schedules the months so that the first two days are a month, the third and fourth are a month, and the last three are their own months, he spends at most $500 in any month. Any other method of scheduling gives a larger minimum monthly limit.

题意:
有n个牛棚,每个牛棚的位置为a[i],m头牛,要求把这m头牛放进牛棚中,并要求这些牛之间互相间隔的距离最大,求这个最大距离
**思路:**二分+贪心
这是一个最小值最大化的问题。先对隔间编号从小到大排序,则最大距离不会超过两端的两头牛之间的差值,最小值为0。所以我们可以通过二分枚举最小值来求。假设当前的最小值为x,如果判断出最小差值为x时可以放下C头牛,就先让x变大再判断;如果放不下,说明当前的x太大了,就先让x变小然后再进行判断。直到求出一个最大的x就是最终的答案。

代码

#include <stdio.h>
#include <string.h>
#include<iostream>
#include <algorithm>
using namespace std;
int num[100005];
int main()
{
	int n, k;
	while (cin >> n >> k)
	{
		int l, r;
		l = 0;
		r = 0;
		for (int i = 0; i < n; i++)
		{
			cin >> num[i];
			r += num[i];
			l = max(l, num[i]);
		}
		while (l < r)
		{
			int mid = (l + r) / 2;
			int cnt = 0;
			int temp = 0;
			for (int i = 0; i < n; i++)
			{
				if (temp + num[i] <= mid)
					temp += num[i];
				else
				{
					cnt++;
					temp = num[i];
				}
			}
			cnt++;
			if (cnt <= k)
				r = mid;
			else
				l = mid+1;
		}
		cout << r << endl;

	}
	return 0;
}

I题

Every year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. The excitement takes place on a long, straight river with a rock at the start and another rock at the end, L units away from the start (1 ≤ L ≤ 1,000,000,000). Along the river between the starting and ending rocks, N (0 ≤ N ≤ 50,000) more rocks appear, each at an integral distance Di from the start (0 < Di < L).

To play the game, each cow in turn starts at the starting rock and tries to reach the finish at the ending rock, jumping only from rock to rock. Of course, less agile cows never make it to the final rock, ending up instead in the river.

Farmer John is proud of his cows and watches this event each year. But as time goes by, he tires of watching the timid cows of the other farmers limp across the short distances between rocks placed too closely together. He plans to remove several rocks in order to increase the shortest distance a cow will have to jump to reach the end. He knows he cannot remove the starting and ending rocks, but he calculates that he has enough resources to remove up to M rocks (0 ≤ M ≤ N).

FJ wants to know exactly how much he can increase the shortest distance before he starts removing the rocks. Help Farmer John determine the greatest possible shortest distance a cow has to jump after removing the optimal set of M rocks.

Input
Line 1: Three space-separated integers: L, N, and M
Lines 2… N+1: Each line contains a single integer indicating how far some rock is away from the starting rock. No two rocks share the same position.

Output
Line 1: A single integer that is the maximum of the shortest distance a cow has to jump after removing M rocks

Sample Input
25 5 2
2
14
11
21
17
Sample Output
4

Hint
Before removing any rocks, the shortest jump was a jump of 2 from 0 (the start) to 2. After removing the rocks at 2 and 14, the shortest required jump is a jump of 4 (from 17 to 21 or from 21 to 25).

题意:
整数数线上,有一个石头在原点代表起点,一个石头在L代表终点,他们之间有N个石头。
想从起点移动到终点,只能从一个石头跳到相邻的下一个石头。求相邻石头间的最短距离。
现在从起点终点以外的N个石头中移走M个石头,
对于每一种移法,移完完都有一个新的最短跳跃距离s’(s’> = s)产生。
请输出s’可能的最大值。

思路:
对a数组排序后,算出每两个石头之间的差值来。
然后二分答案,对每个答案检测是不是可行
用一个数组来记录这个石头和上一个石头间的距离 对每个二分的mid 我们遍历这个差值数组,如果cha[]+dis小于mid 则需要移除一个石头 cnt++。如果大于 就让数组 归零。
代码:

#include<iostream>
#include<algorithm>
using namespace std;
const int N = 50005, INF = 0x3f3f3f3f;
int L, n, m;
int a[N];
bool check(int x)
{
    int cnt = 0;
    int pre = 0;
    for (int i = 1; i <= n + 1; i++)
    {
        if (a[i] - a[pre] < x)
            cnt++;
        else
            pre = i;
    }

    return cnt <= m;
}
int main()
{
    cin >> L >> n >> m;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    a[n + 1] = L;
    sort(a + 1, a + n + 1);
    int lb = 0, ub = INF;
    while (lb + 1 < ub)
    {
        int mid = (lb + ub) >> 1;
        if (check(mid))
            lb = mid;
        else
            ub = mid;
    }
    cout << lb << endl;
    return 0;
}

J题

When a thin rod of length L is heated n degrees, it expands to a new length L’=(1+n*C)*L, where C is the coefficient of heat expansion.
When a thin rod is mounted on two solid walls and then heated, it expands and takes the shape of a circular segment, the original rod being the chord of the segment.

Your task is to compute the distance by which the center of the rod is displaced.

Input
The input contains multiple lines. Each line of input contains three non-negative numbers: the initial lenth of the rod in millimeters, the temperature change in degrees and the coefficient of heat expansion of the material. Input data guarantee that no rod expands by more than one half of its original length. The last line of input contains three negative numbers and it should not be processed.

Output
For each line of input, output one line with the displacement of the center of the rod in millimeters with 3 digits of precision.

Sample Input
1000 100 0.0001
15000 10 0.00006
10 0 0.001
-1 -1 -1
Sample Output
61.329
225.020
0.000

题意:
一根长度为L的木棒,加热n度之后长度变为L’=(1+n*C)*L,其中C是木棒的热膨胀系数。给出L,n,C。求木棒在加热前后中心点的距离是多少
思路:
感觉是高中数学题,好复杂…
由于膨胀的长度绝不会超过原长度的50%,因此膨胀圆心角不会超过180度,也不会少于0度。
此题的核心是找到高度h的表达式,然后探求与角或者圆的半径的关系,然后看是否存在某种单调性,采用二分逼近法求解近似值

代码实现:

#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
#define esp 1e-5
double L, N, C, S;
bool check(double mid)
{
	double ans = 2 * asin((L / 2) / ((L * L + 4 * mid * mid) / (8 * mid))) * ((L * L + 4 * mid * mid) / (8 * mid));
	return ans >= S;
}

int main()
{
	double left, right, mid;

	while (cin >> L >> N >> C)
	{
		if (L + N + C < 0)
			break;
		S = (1 + N * C) * L;
		left = 0.0;
		right = L / 2;

		while (right - left > esp)
		{
			mid = (right + left) / 2;
			if (check(mid))
			{
				right = mid;
			}
			else
			{
				left = mid;
			}
		}
		printf("%.3lf\n", right);
	}
	return 0;
}

L题

Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,…,xN (0 <= xi <= 1,000,000,000).

His C (2 <= C <= N) cows don’t like this barn layout and become aggressive towards each other once put into a stall. To prevent the cows from hurting each other, FJ want to assign the cows to the stalls, such that the minimum distance between any two of them is as large as possible. What is the largest minimum distance?
Input

  • Line 1: Two space-separated integers: N and C

  • Lines 2…N+1: Line i+1 contains an integer stall location, xi
    Output

  • Line 1: One integer: the largest minimum distance

Sample Input
5 3
1
2
8
4
9
Sample Output
3
Hint
OUTPUT DETAILS:

FJ can put his 3 cows in the stalls at positions 1, 4 and 8, resulting in a minimum distance of 3.

Huge input data,scanf is recommended.

题意:
把C头牛放到N个带有编号的隔间里,使得任意两头牛所在的隔间编号的最小差值最大。例如样例排完序后变成1 2 4 8 9,那么1位置放一头牛,4位置放一头牛,它们的差值为3;最后一头牛放在8或9位置都可以,和4位置的差值分别为4、5,和1位置的差值分别为7和8,不比3小,所以最大的最小值为3。

分析:
一个最小值最大化的问题。先对隔间编号从小到大排序,则最大距离不会超过两端的两头牛之间的差值,最小值为0。所以我们可以通过二分枚举最小值来求。假设当前的最小值为x,如果判断出最小差值为x时可以放下C头牛,就先让x变大再判断;如果放不下,说明当前的x太大了,就先让x变小然后再进行判断。直到求出一个最大的x就是最终的答案。

代码

#include<iostream>
#include<algorithm>
#include<cstdio>
#define P 1000000000
using namespace std;
const int maxn=1e5+10;
int x[maxn];
int n, m;
bool ad(int t)//t为两头牛的距离
{
    int last = 0;
    for (int i = 1; i < m; i++) 
    {
        int cur = last + 1;
        while (cur < n && x[cur] - x[last] < t)
        //判定cur位置是否能够放牛,如果能,不会进入循环
            cur++;
        if (cur == n)
            return false;
            //当for循环还没结束,cur==N时说明到最后一个位置是所有的牛还没有安排完,此时返回false
        last = cur;
        //把第i头牛放在编号为cur的牛舍中,这里牛的数量和编号都是从0开始
    }
    return true;
    //能在cur到达最后位置之前跳出for循环说明能够安排所有的牛,所以返回true
}
int main()
{
    while (cin >> n >> m)
    {
        for (int i = 0; i < n; i++)
            cin >> x[i];
        sort(x, x + n);
        int low = 0, high = P;
        while (high - low > 1) 
        {
            int mid = (high + low) >> 1;
            if (ad(mid))
                low = mid;
            else 
                high = mid;
        }
        printf("%d\n", low);
    }
    return 0;
}


转载:https://blog.csdn.net/SDAU_LGX/article/details/105813615
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场