codeforces:F. All Possible Digits【贪心 + 模拟进位】

news2025/1/16 7:48:38

目录

  • 题目截图
  • 题目分析
  • ac code
  • 总结

题目截图

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

题目分析

  • 注意是只能再最后一位加
  • 我们要使得0到p - 1都出现至少一次
  • 统计出现的数字aset
  • 考虑最后一位pivot
  • 情况1:如果pivot前都出现了,就不用进位了,pivot只需要加到最大的未出现在aset的num即可
  • 情况2:pivot前未全部出现,说明要进位,进位说明pivot后都搞定了
  • 进位会引起连锁反应,需要记录因为进位新增的数字addset,特别地,如果第一位还会进位,那么会多出一个1
  • 最后统计aset |= addset,那么最后一位现在是0,只需要统计0加到小于pivot的最大的未出现在aset的num即可

ac code

# -*- coding: utf-8 -*-
# @Time    : 2022/11/19 21:30
# @Author  : bridgekiller
# @FileName: test20221119.py
# @Software: PyCharm
# @Blog    :bridge-killer.blog.csdn.net

import os
import sys
import math
import random
import threading
from copy import deepcopy
from io import BytesIO, IOBase
from types import GeneratorType
from functools import lru_cache, reduce
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from itertools import accumulate, combinations, permutations
from heapq import nsmallest, nlargest, heapify, heappop, heappush
from typing import Generic, Iterable, Iterator, TypeVar, Union, List


def debug(func):
    def wrapper(*args, **kwargs):
        print('----------------')
        res = func(*args, **kwargs)
        print('----------------')
        return res

    return wrapper


def bootstrap(f, stack=[]):
    def wrappedfunc(*args, **kwargs):
        if stack:
            return f(*args, **kwargs)
        else:
            to = f(*args, **kwargs)
            while True:
                if type(to) is GeneratorType:
                    stack.append(to)
                    to = next(to)
                else:
                    stack.pop()
                    if not stack:
                        break
                    to = stack[-1].send(to)
            return to

    return wrappedfunc


class SegTree:
    '''
    支持增量更新,覆盖更新,序列更新,任意RMQ操作
    基于二叉树实现
    初始化:O(1)
    增量更新或覆盖更新的单次操作复杂度:O(log k)
    序列更新的单次复杂度:O(n)
    '''

    def __init__(self, f1, f2, l, r, v=0):
        '''
        初始化线段树[left,right)
        f1,f2示例:
        线段和:
        f1=lambda a,b:a+b
        f2=lambda a,n:a*n
        线段最大值:
        f1=lambda a,b:max(a,b)
        f2=lambda a,n:a
        线段最小值:
        f1=lambda a,b:min(a,b)
        f2=lambda a,n:a
        '''
        self.ans = f2(v, r - l)
        self.f1 = f1
        self.f2 = f2
        self.l = l  # left
        self.r = r  # right
        self.v = v  # init value
        self.lazy_tag = 0  # Lazy tag
        self.left = None  # SubTree(left,bottom)
        self.right = None  # SubTree(right,bottom)

    @property
    def mid_h(self):
        return (self.l + self.r) // 2

    def create_subtrees(self):
        midh = self.mid_h
        if not self.left and midh > self.l:
            self.left = SegTree(self.f1, self.f2, self.l, midh)
        if not self.right:
            self.right = SegTree(self.f1, self.f2, midh, self.r)

    def init_seg(self, M):
        '''
        将线段树的值初始化为矩阵Matrx
        输入保证Matrx与线段大小一致
        '''
        m0 = M[0]
        self.lazy_tag = 0
        for a in M:
            if a != m0:
                break
        else:
            self.v = m0
            self.ans = self.f2(m0, len(M))
            return self.ans
        self.v = '#'
        midh = self.mid_h
        self.create_subtrees()
        self.ans = self.f1(self.left.init_seg(M[:midh - self.l]), self.right.init_seg(M[midh - self.l:]))
        return self.ans

    def cover_seg(self, l, r, v):
        '''
        将线段[left,right)覆盖为val
        '''
        if self.v == v or l >= self.r or r <= self.l:
            return self.ans
        if l <= self.l and r >= self.r:
            self.v = v
            self.lazy_tag = 0
            self.ans = self.f2(v, self.r - self.l)
            return self.ans
        self.create_subtrees()
        if self.v != '#':
            if self.left:
                self.left.v = self.v
                self.left.ans = self.f2(self.v, self.left.r - self.left.l)
            if self.right:
                self.right.v = self.v
                self.right.ans = self.f2(self.v, self.right.r - self.right.l)
            self.v = '#'
        # push up
        self.ans = self.f1(self.left.cover_seg(l, r, v), self.right.cover_seg(l, r, v))
        return self.ans

    def inc_seg(self, l, r, v):
        '''
        将线段[left,right)增加val
        '''
        if v == 0 or l >= self.r or r <= self.l:
            return self.ans
        # self.ans = '?'
        if l <= self.l and r >= self.r:
            if self.v == '#':
                self.lazy_tag += v
            else:
                self.v += v
            self.ans += self.f2(v, self.r - self.l)
            return self.ans
        self.create_subtrees()
        if self.v != '#':
            self.left.v = self.v
            self.left.ans = self.f2(self.v, self.left.r - self.left.l)
            self.right.v = self.v
            self.right.ans = self.f2(self.v, self.right.r - self.right.l)
            self.v = '#'
        self.pushdown()
        self.ans = self.f1(self.left.inc_seg(l, r, v), self.right.inc_seg(l, r, v))
        return self.ans

    def inc_idx(self, idx, v):
        '''
        increase idx by val
        '''
        if v == 0 or idx >= self.r or idx < self.l:
            return self.ans
        if idx == self.l == self.r - 1:
            self.v += v
            self.ans += self.f2(v, 1)
            return self.ans
        self.create_subtrees()
        if self.v != '#':
            self.left.v = self.v
            self.left.ans = self.f2(self.v, self.left.r - self.left.l)
            self.right.v = self.v
            self.right.ans = self.f2(self.v, self.right.r - self.right.l)
            self.v = '#'
        self.pushdown()
        self.ans = self.f1(self.left.inc_idx(idx, v), self.right.inc_idx(idx, v))
        return self.ans

    def pushdown(self):
        if self.lazy_tag != 0:
            if self.left:
                if self.left.v != '#':
                    self.left.v += self.lazy_tag
                    self.left.lazy_tag = 0
                else:
                    self.left.lazy_tag += self.lazy_tag
                self.left.ans += self.f2(self.lazy_tag, self.left.r - self.left.l)
            if self.right:
                if self.right.v != '#':
                    self.right.v += self.lazy_tag
                    self.right.lazy_tag = 0
                else:
                    self.right.lazy_tag += self.lazy_tag
                self.right.ans += self.f2(self.lazy_tag, self.right.r - self.right.l)
            self.lazy_tag = 0

    def query(self, l, r):
        '''
        查询线段[right,bottom)的RMQ
        '''
        if l >= r: return 0
        if l <= self.l and r >= self.r:
            return self.ans
        if self.v != '#':
            return self.f2(self.v, min(self.r, r) - max(self.l, l))
        midh = self.mid_h
        anss = []
        if l < midh:
            anss.append(self.left.query(l, r))
        if r > midh:
            anss.append(self.right.query(l, r))
        return reduce(self.f1, anss)


class SortedList:
    def __init__(self, iterable=[], _load=200):
        """Initialize sorted list instance."""
        values = sorted(iterable)
        self._len = _len = len(values)
        self._load = _load
        self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
        self._list_lens = [len(_list) for _list in _lists]
        self._mins = [_list[0] for _list in _lists]
        self._fen_tree = []
        self._rebuild = True

    def _fen_build(self):
        """Build a fenwick tree instance."""
        self._fen_tree[:] = self._list_lens
        _fen_tree = self._fen_tree
        for i in range(len(_fen_tree)):
            if i | i + 1 < len(_fen_tree):
                _fen_tree[i | i + 1] += _fen_tree[i]
        self._rebuild = False

    def _fen_update(self, index, value):
        """Update `fen_tree[index] += value`."""
        if not self._rebuild:
            _fen_tree = self._fen_tree
            while index < len(_fen_tree):
                _fen_tree[index] += value
                index |= index + 1

    def _fen_query(self, end):
        """Return `sum(_fen_tree[:end])`."""
        if self._rebuild:
            self._fen_build()

        _fen_tree = self._fen_tree
        x = 0
        while end:
            x += _fen_tree[end - 1]
            end &= end - 1
        return x

    def _fen_findkth(self, k):
        """Return a pair of (the largest `idx` such that `sum(_fen_tree[:idx]) <= k`, `k - sum(_fen_tree[:idx])`)."""
        _list_lens = self._list_lens
        if k < _list_lens[0]:
            return 0, k
        if k >= self._len - _list_lens[-1]:
            return len(_list_lens) - 1, k + _list_lens[-1] - self._len
        if self._rebuild:
            self._fen_build()

        _fen_tree = self._fen_tree
        idx = -1
        for d in reversed(range(len(_fen_tree).bit_length())):
            right_idx = idx + (1 << d)
            if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
                idx = right_idx
                k -= _fen_tree[idx]
        return idx + 1, k

    def _delete(self, pos, idx):
        """Delete value at the given `(pos, idx)`."""
        _lists = self._lists
        _mins = self._mins
        _list_lens = self._list_lens

        self._len -= 1
        self._fen_update(pos, -1)
        del _lists[pos][idx]
        _list_lens[pos] -= 1

        if _list_lens[pos]:
            _mins[pos] = _lists[pos][0]
        else:
            del _lists[pos]
            del _list_lens[pos]
            del _mins[pos]
            self._rebuild = True

    def _loc_left(self, value):
        """Return an index pair that corresponds to the first position of `value` in the sorted list."""
        if not self._len:
            return 0, 0

        _lists = self._lists
        _mins = self._mins

        lo, pos = -1, len(_lists) - 1
        while lo + 1 < pos:
            mi = (lo + pos) >> 1
            if value <= _mins[mi]:
                pos = mi
            else:
                lo = mi

        if pos and value <= _lists[pos - 1][-1]:
            pos -= 1

        _list = _lists[pos]
        lo, idx = -1, len(_list)
        while lo + 1 < idx:
            mi = (lo + idx) >> 1
            if value <= _list[mi]:
                idx = mi
            else:
                lo = mi

        return pos, idx

    def _loc_right(self, value):
        """Return an index pair that corresponds to the last position of `value` in the sorted list."""
        if not self._len:
            return 0, 0

        _lists = self._lists
        _mins = self._mins

        pos, hi = 0, len(_lists)
        while pos + 1 < hi:
            mi = (pos + hi) >> 1
            if value < _mins[mi]:
                hi = mi
            else:
                pos = mi

        _list = _lists[pos]
        lo, idx = -1, len(_list)
        while lo + 1 < idx:
            mi = (lo + idx) >> 1
            if value < _list[mi]:
                idx = mi
            else:
                lo = mi

        return pos, idx

    def add(self, value):
        """Add `value` to sorted list."""
        _load = self._load
        _lists = self._lists
        _mins = self._mins
        _list_lens = self._list_lens

        self._len += 1
        if _lists:
            pos, idx = self._loc_right(value)
            self._fen_update(pos, 1)
            _list = _lists[pos]
            _list.insert(idx, value)
            _list_lens[pos] += 1
            _mins[pos] = _list[0]
            if _load + _load < len(_list):
                _lists.insert(pos + 1, _list[_load:])
                _list_lens.insert(pos + 1, len(_list) - _load)
                _mins.insert(pos + 1, _list[_load])
                _list_lens[pos] = _load
                del _list[_load:]
                self._rebuild = True
        else:
            _lists.append([value])
            _mins.append(value)
            _list_lens.append(1)
            self._rebuild = True

    def discard(self, value):
        """Remove `value` from sorted list if it is a member."""
        _lists = self._lists
        if _lists:
            pos, idx = self._loc_right(value)
            if idx and _lists[pos][idx - 1] == value:
                self._delete(pos, idx - 1)

    def remove(self, value):
        """Remove `value` from sorted list; `value` must be a member."""
        _len = self._len
        self.discard(value)
        if _len == self._len:
            raise ValueError('{0!r} not in list'.format(value))

    def pop(self, index=-1):
        """Remove and return value at `index` in sorted list."""
        pos, idx = self._fen_findkth(self._len + index if index < 0 else index)
        value = self._lists[pos][idx]
        self._delete(pos, idx)
        return value

    def bisect_left(self, value):
        """Return the first index to insert `value` in the sorted list."""
        pos, idx = self._loc_left(value)
        return self._fen_query(pos) + idx

    def bisect_right(self, value):
        """Return the last index to insert `value` in the sorted list."""
        pos, idx = self._loc_right(value)
        return self._fen_query(pos) + idx

    def count(self, value):
        """Return number of occurrences of `value` in the sorted list."""
        return self.bisect_right(value) - self.bisect_left(value)

    def __len__(self):
        """Return the size of the sorted list."""
        return self._len

    def __getitem__(self, index):
        """Lookup value at `index` in sorted list."""
        pos, idx = self._fen_findkth(self._len + index if index < 0 else index)
        return self._lists[pos][idx]

    def __delitem__(self, index):
        """Remove value at `index` from sorted list."""
        pos, idx = self._fen_findkth(self._len + index if index < 0 else index)
        self._delete(pos, idx)

    def __contains__(self, value):
        """Return true if `value` is an element of the sorted list."""
        _lists = self._lists
        if _lists:
            pos, idx = self._loc_left(value)
            return idx < len(_lists[pos]) and _lists[pos][idx] == value
        return False

    def __iter__(self):
        """Return an iterator over the sorted list."""
        return (value for _list in self._lists for value in _list)

    def __reversed__(self):
        """Return a reverse iterator over the sorted list."""
        return (value for _list in reversed(self._lists) for value in reversed(_list))

    def __repr__(self):
        """Return string representation of sorted list."""
        return 'SortedList({0})'.format(list(self))


T = TypeVar('T')


class SortedSet(Generic[T]):
    BUCKET_RATIO = 50
    REBUILD_RATIO = 170

    def _build(self, a=None) -> None:
        "Evenly divide `a` into buckets."
        if a is None: a = list(self)
        size = self.size = len(a)
        bucket_size = int(math.ceil(math.sqrt(size / self.BUCKET_RATIO)))
        self.a = [a[size * i // bucket_size: size * (i + 1) // bucket_size] for i in range(bucket_size)]

    def __init__(self, a: Iterable[T] = []) -> None:
        "Make a new SortedSet from iterable. / O(N) if sorted and unique / O(N log N)"
        a = list(a)
        if not all(a[i] < a[i + 1] for i in range(len(a) - 1)):
            a = sorted(set(a))
        self._build(a)

    def __iter__(self) -> Iterator[T]:
        for i in self.a:
            for j in i: yield j

    def __reversed__(self) -> Iterator[T]:
        for i in reversed(self.a):
            for j in reversed(i): yield j

    def __len__(self) -> int:
        return self.size

    def __repr__(self) -> str:
        return "SortedSet" + str(self.a)

    def __str__(self) -> str:
        s = str(list(self))
        return "{" + s[1: len(s) - 1] + "}"

    def _find_bucket(self, x: T) -> List[T]:
        "Find the bucket which should contain x. self must not be empty."
        for a in self.a:
            if x <= a[-1]: return a
        return a

    def __contains__(self, x: T) -> bool:
        if self.size == 0: return False
        a = self._find_bucket(x)
        i = bisect_left(a, x)
        return i != len(a) and a[i] == x

    def add(self, x: T) -> bool:
        "Add an element and return True if added. / O(√N)"
        if self.size == 0:
            self.a = [[x]]
            self.size = 1
            return True
        a = self._find_bucket(x)
        i = bisect_left(a, x)
        if i != len(a) and a[i] == x: return False
        a.insert(i, x)
        self.size += 1
        if len(a) > len(self.a) * self.REBUILD_RATIO:
            self._build()
        return True

    def discard(self, x: T) -> bool:
        "Remove an element and return True if removed. / O(√N)"
        if self.size == 0: return False
        a = self._find_bucket(x)
        i = bisect_left(a, x)
        if i == len(a) or a[i] != x: return False
        a.pop(i)
        self.size -= 1
        if len(a) == 0: self._build()
        return True

    def lt(self, x: T) -> Union[T, None]:
        "Find the largest element < x, or None if it doesn't exist."
        for a in reversed(self.a):
            if a[0] < x:
                return a[bisect_left(a, x) - 1]

    def le(self, x: T) -> Union[T, None]:
        "Find the largest element <= x, or None if it doesn't exist."
        for a in reversed(self.a):
            if a[0] <= x:
                return a[bisect_right(a, x) - 1]

    def gt(self, x: T) -> Union[T, None]:
        "Find the smallest element > x, or None if it doesn't exist."
        for a in self.a:
            if a[-1] > x:
                return a[bisect_right(a, x)]

    def ge(self, x: T) -> Union[T, None]:
        "Find the smallest element >= x, or None if it doesn't exist."
        for a in self.a:
            if a[-1] >= x:
                return a[bisect_left(a, x)]

    def __getitem__(self, x: int) -> T:
        "Return the x-th element, or IndexError if it doesn't exist."
        if x < 0: x += self.size
        if x < 0: raise IndexError
        for a in self.a:
            if x < len(a): return a[x]
            x -= len(a)
        raise IndexError

    def index(self, x: T) -> int:
        "Count the number of elements < x."
        ans = 0
        for a in self.a:
            if a[-1] >= x:
                return ans + bisect_left(a, x)
            ans += len(a)
        return ans

    def index_right(self, x: T) -> int:
        "Count the number of elements <= x."
        ans = 0
        for a in self.a:
            if a[-1] > x:
                return ans + bisect_right(a, x)
            ans += len(a)
        return ans


BUFSIZE = 4096


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin = IOWrapper(sys.stdin)
sys.stdout = IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")


def I():
    return input()


def II():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(input().split())


def LII():
    return list(map(int, input().split()))


def GMI():
    return map(lambda x: int(x) - 1, input().split())


def LGMI():
    return list(map(lambda x: int(x) - 1, input().split()))


def solve():
    n, p = LII()
    a = LII()
    aset = set(a)
    pivot = a[-1]
    # 若最后一位之前已经填满了,无需进位
    flag = True
    cur = 0
    while cur < pivot:
        if cur not in aset:
            flag = False
            break
        cur += 1
    if flag: # 无需进位
        # 只需要加到最大的不在aset中的位置即可
        maxn = p - 1
        while maxn > pivot and maxn in aset:
            maxn -= 1
        return print(maxn - pivot)
    else: # 需要进位
        used = p - pivot
        addset = set() # 由于进位新增的set,比pivot大的都搞定了
        addset.add(0)
        flag = True # 是否需要进位
        for i in range(n - 2, -1, -1):
            if a[i] + 1 != p:
                flag = False
                addset.add(a[i] + 1)
                break
        # 第一位还需要进位
        if flag:
            addset.add(1)
        # 更新set
        aset |= addset
        # 寻找pivot前最大的不在aset中的nums即可
        maxn = pivot - 1
        while maxn > 0 and maxn in aset:
            maxn -= 1
        #print(used, maxn, aset)
        return print(used + maxn)



if __name__ == '__main__':
    for _ in range(II()):
        solve()

总结

  • 看错了题,以为每一位都可以随便加
  • 如果最后一位加的话,确实最多一次进位就可以遍历到所有数字
  • 用set进行while寻找即可,倒序找

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

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

相关文章

【编程题】【Scratch二级】2022.09 小老鼠偷面包

小老鼠偷面包 1. 准备工作 &#xff08;1&#xff09;背景&#xff1a;Stars&#xff0c;绘制如下图所示的迷宫&#xff1b; &#xff08;2&#xff09;角色&#xff1a;Cat 2、Mouse1、Bread。 2. 功能实现 &#xff08;1&#xff09;Cat 2、Mouse1和Bread初始位置和方向如…

机器人C++库(12) Robotics Library 之路径规划算法:PRM、RRT、EET算法

机器人C库&#xff08;12&#xff09;Robotics Library 之路径规划算法&#xff1a;PRM、RRT、EET算法 RL库的运动规划(rl::plan)模块集成了以下经典的路径规划算法&#xff1a; PRM算法:概率路线图算法RRT算法&#xff1a;快速探索随机树算法EET算法&#xff1a;搜索树算法-基…

牧场系统设计与实现-计算机毕业设计源码+LW文档

关键代码 package com.example.controller; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.io.IoUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.huto…

japonensisjava乱码_Java乱码问题原因及解决方案

一. java乱码乱码问题解决思路,java乱码分为以下几种 1. 请求乱码 如果是在请求过程中发生的乱码,有可能是以下几种情况: 参数放在 URL 地址中乱码; 参数在请求体中乱码; 数据库本身乱码; 数据从 Java 应用程序传入数据库的过程中乱码。 2. 响应乱码 如果是响应乱码,那…

Go语言学习(八)-- Gin入门

Gin 是一个 Go (Golang) 编写的轻量级 http web 框架&#xff0c;运行速度非常快。Gin 最擅长的就是 Api 接口的高并发&#xff0c;如果项目的规模不大&#xff0c;业务相对简单&#xff0c;这个时候我们 也推荐您使用 Gin。 当某个接口的性能遭到较大挑战的时候&#xff0c;这…

Prometheus监控案例

一&#xff1a;环境规划&#xff1a; 主机名主机地址角色node4192.168.188.114prometheus客户端node5192.168.188.115prometheus服务端 二. 监控远程linux主机&#xff1a; 1. 解压node_exporter压缩包&#xff1a; [rootnode4 ~]# tar xf node_exporter-1.3.1.linux-amd64…

RT-Thread 下的文件内容对比 MSH shell cmd 命令实现方法

前言 在使用 RT-Thread 时&#xff0c;需要对两个文件的内容进行比较&#xff0c;顺手写了一个测试的 MSH shell 命令&#xff0c;经过优化&#xff0c;发现功能可以使用 RT-Thread 下支持多种文件系统&#xff0c;如FAT等&#xff0c;可以通过 USB、串口 的 Ymodem 等协议把文…

YOLOv5-seg数据集制作、模型训练以及TensorRT部署

YOLOv5-seg数据集制作、模型训练以及TensorRT部署版本声明一、数据集制作&#xff1a;图像 Json转txt二、分割模型训练三 tensorRT部署版本声明 yolov5-seg:官方地址&#xff1a;https://github.com/ultralytics/yolov5/tree/v6.2 TensorRT&#xff1a;8.x.x 语言&#xff1a;…

基于stm32单片机体重秤电子秤超重提醒

资料编号&#xff1a;107 下面是相关功能视频演示&#xff1a; 107-基于stm32单片机体重秤电子秤称重超重报警Proteus仿真&#xff08;源码仿真全套资料&#xff09;功能介绍&#xff1a; 采用stm32单片机&#xff0c;可以设置称重上限制&#xff0c;LCD1602显示重量&#xf…

04_tcp

知识点1【多播】 多播地址&#xff1a; 多播地址向以太网MAC地址的映射 UDP多播工作过程&#xff1a; 多播地址结构体&#xff1a; 多播套接口选项&#xff1a; 知识点2【TCP面向链接编程】 1、创建tcp套接字 2、做为客户端需要具备的条件 3、connect链接服务器的函数…

地图下载白嫖神器!你该怎么用好它

今天介绍一下做数据可视化网站比较好的两个平台。一个是阿里云的Datav&#xff0c;另一个是易智微easyv. 一、DataV.GeoAtlas 前段时间 我们就给大家分享过阿里云的DataV.GeoAtlas地理小工具系列。我们可以通过这个平台下载高德比较新的地图数据&#xff0c;数据的时效性是有较…

如何查看SAP版本及HANA版本?

目录 一、查SAP NetWeaver版本 二、查看S/4 HANA版本 在SAP运维及系统集成时&#xff0c;经常外面公司问及本公司的SAP版本及HANA版本。其实是每一个登录SAP的用户都可以查到的。方法如下&#xff1a; 一、查SAP NetWeaver版本 SAP界面上选择菜单&#xff1a;系统-状态&am…

哈夫曼树与哈夫曼编码

哈夫曼树&#xff1a;结点中赋予一个某种意义的值&#xff0c;称为结点的权值&#xff0c;从根结点开始&#xff0c;到目标结点经过的边数&#xff0c;称为路径长度&#xff0c;路径长度乘以权值&#xff0c;称为带权路径长度&#xff1b; 例如&#xff1a;根结点代表着快递集…

上位机工业协议-S7COMM

1、S7协议主要针对西门子相关设备通信。先了解基本通信对象、通信环境、通信报文&#xff0c;再处理S7COMM通信库的封装与测试。 2、西门子设备通信 - PLC&#xff1a;系列 LOGO、200、200Smart、300、400、1200、1500 - PLC&#xff1a;LOGO、200、200Smart、300、400、1…

Elastic Stack容器化部署拓展(Https、AD域集成)并收集Cisco设备的日志信息

前言&#xff1a; 还记得在去年的笔记中提到过EFK&#xff08;Elasticsearch-Filebeat-Kibana&#xff09;的部署&#xff0c;但是其中的内容相对简单&#xff0c;也没有提到一些额外的Elastic Stack的特性。链接如下&#xff1a;https://blog.csdn.net/tushanpeipei/article/…

JSTL使用

目录 简介&#xff1a; 组成 使用&#xff1a; code核心库使用 ​编辑 fmt格式化 ​编辑 简介&#xff1a; 全称:JSP Standard Tag Library 中文名:JSP标准标签库 作用:用于扩展JSP中的标签&#xff0c;能够为JSP页面提供流程控制、类型转换等功能的标签。替换JSP中代码…

【Spring Cloud实战】Ribbon负载均衡

gitee地址&#xff1a;https://gitee.com/javaxiaobear/spring-cloud_study.git 在线阅读地址&#xff1a;https://javaxiaobear.gitee.io/ 1、概述 Spring Cloud Ribbon是基于Netflix Ribbon实现的一套客户端负载均衡的工具。 简单的说&#xff0c;Ribbon是Netflix发布的开源项…

jenkins持续集成 自动化部署

一、环境准备 1.1 Java环境 &#xff08;1&#xff09;安装jdk1.8 yum -y install java-1.8.0-openjdk* &#xff08;2&#xff09;执行以下命令查看是否安装成功 java -version 1.2 安装maven &#xff08;1&#xff09;将安装包上传到Linux服务器&#xff0c;解压缩 tar -…

对笔记本电池的研究

文章目录设计容量&完全充电容量笔记本电池报告显示电池设计与系统电池的全部充电容量之间的差异解释电池损耗正确做法查看笔记本的电池使用报告方法第一步&#xff1a;WinR键输入cmd&#xff0c;打开命令提示符窗口第二步&#xff1a;输入powercfg /batteryreport&#xff…

代码规范-对抗软件复杂度

1、为什么需要代码规范 任何系统性的项目都需要架构设计&#xff0c;而架构设计的核心命题是控制复杂度。 但随着项目的不断迭代&#xff0c;复杂度就会不断上升&#xff0c;研发效率就会不断下降。 而代码规范正是对抗软件复杂度的有效手段&#xff0c;通过约定俗成的规则…