边界点射箭问题

news2024/9/23 21:30:25

问题

题目

  • 问题: 给定一个有目标位置和边界单元格为空的 n × n 方格表,找出哪个位于边界单
    元格的箭头会击中最多连续的目标而不经过目标之间的任何空单元格。箭头方向为:
    (A)←、(B) ↑、 © →、(D) ↓、(E) ↖、 (F) ↗、 (G) ↘ 和 (H) ↙。 将箭头的位置和方向
    输出为 3 个字符的字符串。按照行优先的方式,左上角被识别为行 = 0 和列 = 0。
  • 示例:
    在这里插入图片描述
  • 通过检验每个边界位置,从位置(4,0)出发的 C 箭头比任何其他位置有更多的目标可以击中,因为它击中了 2 个目标。从同一位置出发的 F 箭头如果不首先经过从位置(5 , 0)出发,F 一个空单元格,就不能击中任何目标。 箭头将击中一个目标,H 箭头将偏离这个方格表。然后检验其他位置,从位置(5,1)出发的 B 箭头将只击中一个目标,从位置(4,5)出发的 A 箭头也一样。所以输出为 40C 。

输入

  • 将有一个整数表示方格表的大小,另一个字符串表示目标的位置,每个位置由一个空格分隔。我们保证方格表不大于10 × 10。

输出

  • 对于每个方格表,输出一个有 3 个字符的字符串表示箭头的位置和方向,该箭头在不经过任何空单元格的情况下可以击中最多目标。在平局的情况下,输出按 ASCII顺序排在前面的字符串(例如 “05F”< “50A”)。

样本输入

  1. 6
    13 21 41 42 44
  2. 5
    31 21 13 32 11 12
  3. 10
    81 84 86 87 88 71 73 75 77 32 33 45 47 48 11 13 15 16
  4. 8
    65 45 55 32 42 54 13 14 41 61 24
  5. 4
    12 22 21

样本输出:

  1. 40C
  2. 01D
  3. 89A
  4. 05D
  5. 02D

测试输入

  1. 9
    11 14 17 33 44 24 31 35 37 45 41 53 57 62 64 66 71 77
  2. 7
    15 23 24 32 35 31 45 55 44
  3. 6
    43 33 44 14 23 41
  4. 10
    25 71 82 63 54 45 56 75 77 88 21 24 26 27 28 12 13 15 34 35
    33 37
  5. 8
    12 13 16 21 22 31 34 35 36 45 43 41 52 54 56 66 65 64 63 61

测试输出

  1. 80F
  2. 65B
  3. 03D
  4. 29A
  5. 27H

解答

分析

  • 先判断一个方向的临近第一点,如果有就朝这个方向继续算下一点,如果没有就跳过该方向。
  • 最多射中的点是n-2。
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

程序

# 箭头处在边界位置上,需要判断边界的标号

def format_input():
    """
    格式化输出的内容,将输入的字符串转换成数值(整数)
    :return:
        n:方格行列数。
        target_location_list:目标坐标列表。
    """
    n = int(input("请输入:\n"))  # 方格大小 n * n
    # 目标位置
    target_location_str = input().split(" ")  # 通过空格切分为列表
    # print(target_location_str)    # ['13', '21', '41', '42', '44']
    target_location_list = [list(item) for item in target_location_str]  # 将坐标字符串转换成列表
    # print(target_location_list_str)
    for i in range(len(target_location_list)):  # 将字符串坐标转换成数字坐标
        target_location_list[i][0] = int(target_location_list[i][0])
        target_location_list[i][1] = int(target_location_list[i][1])
    # print(target_location_list)
    return n, target_location_list


def get_border_location(n):
    """
    根据表格规格得到边界坐标列表。
    :param n: 表格规格 n * n。
    :return: border_location_list
    """
    border_location_list = []    # 总的边界点个数应该是:n*2+(n-2)*2
    for i in range(n):
        # 第一行
        border_location_list.append([0, i])
        # 最后一行
        border_location_list.append([n-1, i])
    for i in range(1, n-1):
        # 最左侧
        border_location_list.append([i, 0])
        # 最右侧
        border_location_list.append([i, n-1])
    return border_location_list


def move_to_get_step_list(max_add, border_dot, target_location, step_list_list):   # 通过移动找到目标路径(射箭后箭经过的路线)
    """
    为了防止get_shout_situation()方法太过冗长,故写此方法,用于在get_shout_situation()方法中调用,找到所有的射箭可用路径。
    :param max_add: 可能的最多可以射中的目标。
    :param border_dot: 某一个边界点坐标。
    :param target_location: 目标位置列表
    :param step_list_list: 射中目标的路径列表
    :return: step_list_list:射中目标的路径列表,作为下一个get_shout_situation()方法内的循环运行的move_to_get_step_list()方法的参数
    """

    # A:向左  B:向上  C:向右  D:向下  E:左上  F:右上  G:右下  H:左下
    # 1. 向左:A : x,y-1
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0], border_dot[1] - i]  # x,y-1
        if assume_target in target_location and assume_target not in temp_step:
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:
            continue
        else:
            break

    # 2. 向上:B : x-1,y
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0] - i, border_dot[1]]  # x-1,y
        if assume_target in target_location and assume_target not in temp_step:
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:
            continue
        else:
            break

    # 3. 向左:C : x,y+1
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0], border_dot[1] + i]  # x,y+1
        if assume_target in target_location and assume_target not in temp_step:
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:
            continue
        else:
            break
    # 4. 向下:D : x+1,y
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0] + i, border_dot[1]]  # x+1,y
        if assume_target in target_location and assume_target not in temp_step:
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:
            continue
        else:
            break
    # 5. 向左上:E : x-1,y-1
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0] - i, border_dot[1] - i]  # x-1,y-1
        if assume_target in target_location and assume_target not in temp_step:
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:
            continue
        else:
            break
    # 6. 向右上:F : x-1,y+1
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0] - i, border_dot[1] + i]  # x-1,y+1
        if assume_target in target_location and assume_target not in temp_step:
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:
            continue
        else:
            break
    # 7. 向右下:G : x+1,y+1
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0] + i, border_dot[1] + i]  # x+1,y+1
        if assume_target in target_location and assume_target not in temp_step:
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:
            continue
        else:
            break
    # 8. 向左下:H : x+1,y-1
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0] + i, border_dot[1] - i]  # x+1,y-1
        if assume_target in target_location and assume_target not in temp_step:
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:
            continue
        else:
            break
    return step_list_list


def get_coordinate_direction_str_by_coordinate_list(coordinate_list):
    """
    通过坐标列表得到坐标方向字符串。(第一个坐标就是一个边界点的坐标,第二个坐标是第一个经过的目标点坐标)。通过两个坐标之前的值关系获得方向。
    :param coordinate_list: 路径坐标列表
    :return: coordinate_direction_str: 坐标方向字符串(坐标是第一个坐标,也就是某个边界点坐标)。
    """
    border_coordinate = coordinate_list[0]   # 边界点坐标
    x1, y1 = border_coordinate[0], border_coordinate[1]   # 横坐标,纵坐标
    first_target_coordinate = coordinate_list[1]   # 第一个目标的坐标
    x2, y2 = first_target_coordinate[0], first_target_coordinate[1]   # 横坐标, 纵坐标
    direction = ""
    if x1 == x2 and y1 - 1 == y2:
        direction = "A"
    if x1 - 1 == x2 and y1 == y2:
        direction = "B"
    if x1 == x2 and y1 + 1 == y2:
        direction = "C"
    if x1 < x2 and y1 == y2:
        direction = "D"
    if x1 - 1 == x2 and y1 - 1 == y2:
        direction = "E"
    if x1 - 1 == x2 and y1 + 1 == y2:
        direction = "F"
    if x1 + 1 == x2 and y1 + 1 == y2:
        direction = "G"
    if x1 + 1 == x2 and y1 - 1 == y2:
        direction = "H"
    return str(x1) + str(y1) + direction


def get_longest_shout_situation(n, target_location, border_location):
    """
    得到射中目标最多的射箭情景。
    :param n: 矩阵的规格大小(n * n)。
    :param target_location: 所有目标坐标列表。
    :param border_location: 所有边界点坐标列表。
    :return:
    """
    max_add = n - 2    # 最多假设可射中的点数
    # 记录走势列表
    step_list_list = []
    # 遍历边界点列表:
    for border_dot in border_location:
        # A:向左  B:向上  C:向右  D:向下  E:左上  F:右上  G:右下  H:左下
        #  示例:向左:A : x,y-1
        step_list_list = move_to_get_step_list(max_add, border_dot, target_location, step_list_list)

    for i in range(len(step_list_list)):
        print(i, ": ", step_list_list[i])
    max_len = 0    # 获取最长的路径
    for i in range(len(step_list_list)):
        temp_len = len(step_list_list[i])
        if temp_len > max_len:
            max_len = temp_len
    print("最长路径长度", max_len)
    max_len_index_list = []    # 记录最长路径的下标位置
    for i in range(len(step_list_list)):
        if len(step_list_list[i]) == max_len:
            max_len_index_list.append(i)
    print("最长路径下标", max_len_index_list)
    max_len_str = []    # 记录最长的坐标方向字符串
    for index in max_len_index_list:
        target_coordinate_list = step_list_list[index]
        print("目标:", target_coordinate_list)
        temp_str = get_coordinate_direction_str_by_coordinate_list(target_coordinate_list)
        max_len_str.append(temp_str)
    print(max_len_str)
    min_coordinate_direction_str = min(max_len_str)
    print(min_coordinate_direction_str)


def main():
    # 1. 获得表格大小和目标的坐标(格式化输入的内容:表格大小和目标坐标)
    n, target_location = format_input()
    print("表格规格大小", n)
    print("目标点坐标", target_location)
    # 2. 得到边界的坐标
    border_location = get_border_location(n)
    print("边界点坐标", border_location)
    print("实际的边界点个数", len(border_location))
    print("理论上边界点个数(n*2+(n-2)*2)", n*2+(n-2)*2)
    # 3. 根据表格规格、目标点列表、边界点列表得到目标的射中情况
    get_longest_shout_situation(n, target_location, border_location)


if __name__ == "__main__":
    main()

  • 屏蔽了输出过程提示的:
# 箭头处在边界位置上,需要判断边界的标号

def format_input():
    """
    格式化输出的内容,将输入的字符串转换成数值(整数)
    :return:
        n:方格行列数。
        target_location_list:目标坐标列表。
    """
    n = int(input("请输入:\n"))  # 方格大小 n * n
    # 目标位置
    target_location_str = input().split(" ")  # 通过空格切分为列表
    # print(target_location_str)    # ['13', '21', '41', '42', '44']
    target_location_list = [list(item) for item in target_location_str]  # 将坐标字符串转换成列表
    # print(target_location_list_str)
    for i in range(len(target_location_list)):  # 将字符串坐标转换成数字坐标
        target_location_list[i][0] = int(target_location_list[i][0])
        target_location_list[i][1] = int(target_location_list[i][1])
    # print(target_location_list)
    return n, target_location_list


def get_border_location(n):
    """
    根据表格规格得到边界坐标列表。
    :param n: 表格规格 n * n。
    :return: border_location_list
    """
    border_location_list = []    # 总的边界点个数应该是:n*2+(n-2)*2
    for i in range(n):
        # 第一行
        border_location_list.append([0, i])
        # 最后一行
        border_location_list.append([n-1, i])
    for i in range(1, n-1):
        # 最左侧
        border_location_list.append([i, 0])
        # 最右侧
        border_location_list.append([i, n-1])
    return border_location_list


def move_to_get_step_list(max_add, border_dot, target_location, step_list_list):   # 通过移动找到目标路径(射箭后箭经过的路线)
    """
    为了防止get_shout_situation()方法太过冗长,故写此方法,用于在get_shout_situation()方法中调用,找到所有的射箭可用路径。
    :param max_add: 可能的最多可以射中的目标。
    :param border_dot: 某一个边界点坐标。
    :param target_location: 目标位置列表
    :param step_list_list: 射中目标的路径列表
    :return: step_list_list:射中目标的路径列表,作为下一个get_shout_situation()方法内的循环运行的move_to_get_step_list()方法的参数
    """
    # A:向左  B:向上  C:向右  D:向下  E:左上  F:右上  G:右下  H:左下
    # 1. 向左:A : x,y-1
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0], border_dot[1] - i]  # x,y-1     # 假定的目标
        if assume_target in target_location and assume_target not in temp_step:   # 判断假定目标是否在目标列表中, 并且假定目标是否在当前的路线中
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:    # 当发射箭头到达第一个目标之前经过的空格就跳过
            continue
        else:
            break

    # 2. 向上:B : x-1,y
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0] - i, border_dot[1]]  # x-1,y
        if assume_target in target_location and assume_target not in temp_step:
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:
            continue
        else:
            break

    # 3. 向左:C : x,y+1
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0], border_dot[1] + i]  # x,y+1
        if assume_target in target_location and assume_target not in temp_step:
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:
            continue
        else:
            break
    # 4. 向下:D : x+1,y
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0] + i, border_dot[1]]  # x+1,y
        if assume_target in target_location and assume_target not in temp_step:
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:
            continue
        else:
            break
    # 5. 向左上:E : x-1,y-1
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0] - i, border_dot[1] - i]  # x-1,y-1
        if assume_target in target_location and assume_target not in temp_step:
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:
            continue
        else:
            break
    # 6. 向右上:F : x-1,y+1
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0] - i, border_dot[1] + i]  # x-1,y+1
        if assume_target in target_location and assume_target not in temp_step:
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:
            continue
        else:
            break
    # 7. 向右下:G : x+1,y+1
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0] + i, border_dot[1] + i]  # x+1,y+1
        if assume_target in target_location and assume_target not in temp_step:
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:
            continue
        else:
            break
    # 8. 向左下:H : x+1,y-1
    temp_step = [border_dot]
    for i in range(1, max_add+1):
        assume_target = [border_dot[0] + i, border_dot[1] - i]  # x+1,y-1
        if assume_target in target_location and assume_target not in temp_step:
            temp_step.append(assume_target)
            if temp_step not in step_list_list:
                step_list_list.append(temp_step)
        elif assume_target not in target_location and len(temp_step) == 1:
            continue
        else:
            break
    return step_list_list


def get_coordinate_direction_str_by_coordinate_list(coordinate_list):
    """
    通过坐标列表得到坐标方向字符串。(第一个坐标就是一个边界点的坐标,第二个坐标是第一个经过的目标点坐标)。通过两个坐标之前的值关系获得方向。
    :param coordinate_list: 路径坐标列表
    :return: coordinate_direction_str: 坐标方向字符串(坐标是第一个坐标,也就是某个边界点坐标)。
    """
    border_coordinate = coordinate_list[0]   # 边界点坐标
    x1, y1 = border_coordinate[0], border_coordinate[1]   # 横坐标,纵坐标
    first_target_coordinate = coordinate_list[1]   # 第一个目标的坐标
    x2, y2 = first_target_coordinate[0], first_target_coordinate[1]   # 横坐标, 纵坐标
    direction = ""
    if x1 == x2 and y1 - 1 == y2:
        direction = "A"
    if x1 - 1 == x2 and y1 == y2:
        direction = "B"
    if x1 == x2 and y1 + 1 == y2:
        direction = "C"
    if x1 < x2 and y1 == y2:
        direction = "D"
    if x1 - 1 == x2 and y1 - 1 == y2:
        direction = "E"
    if x1 - 1 == x2 and y1 + 1 == y2:
        direction = "F"
    if x1 + 1 == x2 and y1 + 1 == y2:
        direction = "G"
    if x1 + 1 == x2 and y1 - 1 == y2:
        direction = "H"
    return str(x1) + str(y1) + direction


def get_longest_shout_situation(n, target_location, border_location):
    """
    得到射中目标最多的射箭情景。
    :param n: 矩阵的规格大小(n * n)。
    :param target_location: 所有目标坐标列表。
    :param border_location: 所有边界点坐标列表。
    :return:
    """
    max_add = n - 2    # 最多假设可射中的点数
    # 记录走势列表
    step_list_list = []
    # 遍历边界点列表:
    for border_dot in border_location:
        # A:向左  B:向上  C:向右  D:向下  E:左上  F:右上  G:右下  H:左下
        #  示例:向左:A : x,y-1
        step_list_list = move_to_get_step_list(max_add, border_dot, target_location, step_list_list)

    # for i in range(len(step_list_list)):
        # print(i, ": ", step_list_list[i])
    max_len = 0    # 获取最长的路径
    for i in range(len(step_list_list)):
        temp_len = len(step_list_list[i])
        if temp_len > max_len:
            max_len = temp_len
    # print("最长路径长度", max_len)
    max_len_index_list = []    # 记录最长路径的下标位置
    for i in range(len(step_list_list)):
        if len(step_list_list[i]) == max_len:
            max_len_index_list.append(i)
    # print("最长路径下标", max_len_index_list)
    max_len_str = []    # 记录最长的坐标方向字符串
    for index in max_len_index_list:
        target_coordinate_list = step_list_list[index]
        # print("目标:", target_coordinate_list)
        temp_str = get_coordinate_direction_str_by_coordinate_list(target_coordinate_list)
        max_len_str.append(temp_str)
    # print(max_len_str)
    min_coordinate_direction_str = min(max_len_str)
    print(min_coordinate_direction_str)


def main():
    # 1. 获得表格大小和目标的坐标(格式化输入的内容:表格大小和目标坐标)
    n, target_location = format_input()
    # print("表格规格大小", n)
    # print("目标点坐标", target_location)
    # 2. 得到边界的坐标
    border_location = get_border_location(n)
    # print("边界点坐标", border_location)
    # print("实际的边界点个数", len(border_location))
    # print("理论上边界点个数(n*2+(n-2)*2)", n*2+(n-2)*2)
    # 3. 根据表格规格、目标点列表、边界点列表得到目标的射中情况
    get_longest_shout_situation(n, target_location, border_location)


if __name__ == "__main__":
    main()

运行结果

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/464681.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Nginx反向代理+Keepalived实现Nginx高可用

Keepalived概述&#xff1a; keepalived 是一个类似于 layer3, 4 & 5 交换机制的软件&#xff0c;也就是我们平时说的第 3 层、第 4 层和第 5层交换。 Keepalived 的作用是检测 web 服务器的状态&#xff0c;如果有一台 web 服务器死机&#xff0c;或工作出现故障&#xff…

[极客大挑战 2019]Havefun、[ACTF2020 新生赛]Include、[SUCTF 2019]EasySQL

[极客大挑战 2019]Havefun 进入环境就如下图啥都没给我查看了一下源码 直接给出了flag???尝试了一下结果是一个假的flag&#xff0c;然后我们分析源代码很容易看出我们通过GET方式给cat传一个值&#xff0c;如果cat的值为dog就输出flag&#xff0c;这很简单了我们通过get方…

京东2023年Q1财报预测:短期增速承压,收入和净利润预测被下调

来源&#xff1a;猛兽财经 作者&#xff1a;猛兽财经 猛兽财经获悉&#xff0c;中信证券近期发布研报维持京东&#xff08;JD&#xff09;买入评级&#xff0c;中信证券在研报中预计京东2023年第一季度的营收将达到2,383亿元/同比减少-0.6%&#xff0c;Non-GAAP净利润50.6亿元/…

AI剧本拆解,教你利用AI快速拆解剧本

AI剧本拆解是一项将影视、戏剧等剧本进行分析和优化的技术&#xff0c;可以帮助制作团队更好地规划角色、情节、场景等元素&#xff0c;并提升作品的艺术水平和观赏体验。 1、为什么要拆解剧本&#xff1f; 剧本拆解是制片人和导演的第一项工作&#xff0c;把剧本中各项要素分…

【Python入门第五十四天】Python丨NumPy ufuncs

什么是 ufuncs&#xff1f; ufuncs 指的是“通用函数”&#xff08;Universal Functions&#xff09;&#xff0c;它们是对 ndarray 对象进行操作的 NumPy 函数。 为什么要使用 ufuncs&#xff1f; ufunc 用于在 NumPy 中实现矢量化&#xff0c;这比迭代元素要快得多。 它们…

win系统jenkins搭建+tomcat启动

简介 Jenkins是一个开源软件项目&#xff0c;是基于Java开发的一种持续集成工具&#xff0c;用于监控持续重复的工作&#xff0c;旨在提供一个开放易用的软件平台&#xff0c;使软件项目可以进行持续集成 下载war包 下载地址 (镜像安装 docker pull jenkins/jenkins:lts) …

面板数据进行熵值法

面板数据熵值法分析流程如下&#xff1a; 一、案例背景 当前有9家公司连续5年&#xff08;2018-2022年&#xff09;的财务指标数据&#xff0c;想要通过这份数据&#xff0c;确定各个财务指标的权重。熵值法根据指标离散程度确定赋权大小&#xff0c;客观公正准确度高。本次收…

python安装三方库教程:关于pip命令的一切,到底怎么用?

python安装三方库教程&#xff1a;关于pip命令的一切&#xff0c;到底怎么用&#xff1f; 一、pip设置国内源&#xff1a;1.1如何本地配置源&#xff1a;1.1.1 方法1&#xff1a;下载的时候指定地址1.1.2 方法2&#xff1a;使用pip命令生成配置文件1.1.3 方法3&#xff1a;自定…

vue---组件通信

目录 1、组件跨层级访问 &#xff08;1&#xff09;$emit &#xff08;2&#xff09;$root 、 $parent、$refs 2、依赖注入 3、透传及组件二次封装 组件间通信的三种方案&#xff1a; 1、组件跨层级访问&#xff0c;2、依赖注入,3、透传&#xff08;用于组件二次封装&…

React Hooks 钩子函数错误用法,你还在犯这些错误吗

React Hooks 常见错误 前言 本片文章主要是在写react hooks的时候&#xff0c;遇到的常见错误的写法&#xff0c;和错误。也是一个对只是的巩固和总结。 错误一 上代码&#xff1a;正确写法 function TestReactHooksError() {const [test, setTest] useState(test);useEff…

论文阅读:PVO: Panoptic Visual Odometry

全景视觉里程计、同时做全景分割和视觉里程计 连接&#xff1a;PVO: Panoptic Visual Odometry 0.Abstract 我们提出了一种新的全景视觉里程计框架PVO&#xff0c;以实现对场景运动、几何和全景分割信息的更全面的建模。我们将视觉里程计(VO)和视频全景分割(VPS)在一个统一的…

【hello Linux】进程间通信——匿名管道

目录 前言&#xff1a; 总结下上述的内容&#xff1a; 1. 进程间通信目的 2. 进程间通信的分类 1. 匿名管道 2. 匿名管道的使用 1. 匿名管道的创建 2. 使用匿名管道进行父子间通信 Linux&#x1f337; 前言&#xff1a; 进程具有独立性&#xff0c;拥有独立的数据、代码及其他…

人工智能时代来临,殊不知低代码早已出手

科普一下人工智能的等级划分&#xff0c;按照实力&#xff0c;人工智能可以分为弱人工智能(Artificial Narrow Intelligence&#xff0c;简称ANI)、强人工智能(Artificial General Intelligence简称AGI)、超人工智能(Artificial Superintelligence简称ASI)三个等级。 弱人工智能…

Windows下 批量重命名文件【bat实现】

目录 前言 一、Windows简单实现重命名 二、使用命令行和Excel实现重命名 前言 在实际应用中&#xff0c;我们经常会遇到将指定文件夹下的文件重命名&#xff0c;以便程序读写。 本文介绍了两种方式&#xff0c;都是在Windows系统中自带的重命名方式。 一、Windows简单实现…

面试题目 002

分享一位读者面试美团 java 岗位的面经。主要在考察 javamysql 算法题目 最长回文串 根据前序中序恢复二叉树 说一说 MySQL 的索引 MySQL 的索引是一种存储数据结构&#xff0c; 按照数据结构划分&#xff0c;MySQL 可以分为 B 树索引、Hash 索引、全文索引 按照 B 树的叶子…

Windows云主机崩溃了怎么办?

​  无法避免服务器崩溃已不是什么秘密&#xff0c;无论选择Windows 云主机还是 Linux 云主机。但不可否认的是&#xff0c;任何错误都可能给企业带来灾难性的后果。该怎么办?持续监控服务器是可能的解决方案之一。即便如此&#xff0c;如果服务器已经处于关闭阶段&#xff…

机器学习实战教程(十):逻辑回归

概述 逻辑回归&#xff08;Logistic Regression&#xff09;是一种用于解决二分类或多分类问题的统计学习方法。它以自变量线性组合的形式进行建模&#xff0c;并使用Sigmoid函数将结果映射到[0, 1]的值域内&#xff0c;表示样本属于某个类别的概率。 Logistic Regression是最…

6个好用的企业管理软件推荐

企业管理软件的范围很广&#xff0c;财务、人力、客户关系管理、ERP、客户体验管理等等。国内来看&#xff0c;有些企业管理软件产品能覆盖企业数字化所有部分&#xff0c;在每个领域&#xff0c;也有很突出的头部厂商&#xff0c;产品功能和服务都大幅领先于竞对&#xff0c;我…

Redis学习笔记大全

文章目录 1、redis概述和安装1.1、安装redis1.2、启动redis方式1&#xff1a;前台启动&#xff08;不推荐&#xff09;方式2&#xff1a;后端启动&#xff08;推荐&#xff09; 1.3、关闭redis1.4、进入redis命令窗口1.5、redis命令大全1.6、redis介绍相关知识 2、redis 5大数据…

PyTorch实战3:天气识别

&#x1f368; 本文为&#x1f517;365天深度学习训练营 中的学习记录博客&#x1f366; 参考文章&#xff1a;365天深度学习训练营-第P3周&#xff1a;天气识别&#x1f356; 原作者&#xff1a;K同学啊|接辅导、项目定制 目录 一、前期准备1、导入数据2、transforms.Compose详…