力扣刷题篇之位运算

news2024/9/25 13:22:58

系列文章目录


目录

系列文章目录

前言

一、位运算的基本运算

二、位运算的技巧

三、布隆过滤器

总结


前言

本系列是个人力扣刷题汇总,本文是数与位。刷题顺序按照[力扣刷题攻略] Re:从零开始的力扣刷题生活 - 力扣(LeetCode)

位运算其实之前的 左程云算法与数据结构代码汇总之排序(Java)-CSDN博客

也有总结到过。 原数异或0等于本身,原数异或本身等于0。异或可以看作无进位相加。


一、位运算的基本运算

136. 只出现一次的数字 - 力扣(LeetCode)

 

class Solution {
    public int singleNumber(int[] nums) {
        int result=0;
        for(int num:nums){
            result=result^num;
        }
        return result;
    }
}

 

190. 颠倒二进制位 - 力扣(LeetCode)

通过循环,将 result 左移一位,然后将 n 的最低位加到 result 中,最后右移 n,处理下一位。重复这个过程直到处理完 n 的所有位。 

public class Solution {
    // you need treat n as an unsigned value
    public int reverseBits(int n) {
        int result = 0;
        for (int i = 0; i < 32; i++) {
            // 将 result 左移一位,空出最低位
            result <<= 1;
            // 取 n 的最低位,加到 result 中
            result |= (n & 1);
            // 右移 n,继续处理下一位
            n >>= 1;
        }
        return result;
    }
}

 

 191. 位1的个数 - 力扣(LeetCode)

通过循环,将 n 与 1 进行位与操作,统计最低位是否为 1,然后将 n 右移一位,继续处理下一位,直到 n 的所有位都处理完。 

public class Solution {
    // you need to treat n as an unsigned value
    public int hammingWeight(int n) {
        int count = 0;
        while (n != 0) {
            // 将 n 与 1 进行位与操作,统计最低位是否为 1
            count += (n & 1);
            // 将 n 右移一位
            n >>>= 1;
        }
        return count;
    }
}

 

201. 数字范围按位与 - 力扣(LeetCode)

 通过找到 left 和 right 二进制表示的最长公共前缀来解决。因为对于任何不同的位,按位与的结果一定是 0。

class Solution {
    public int rangeBitwiseAnd(int left, int right) {
        int shift = 0;
        // 找到最长公共前缀
        while (left < right) {
            left >>= 1;
            right >>= 1;
            shift++;
        }
        // 将最长公共前缀左移,右边用零填充
        return left << shift;
    }
}

 

338. 比特位计数 - 力扣(LeetCode)

 

class Solution {
    public int[] countBits(int n) {
        int[] ans = new int[n+1];
        ans[0] = 0;
        for(int i = 1; i <= n; i++) {
            ans[i] = ans[i >> 1] + i % 2;
        }
        return ans;
    }
}

二、位运算的技巧

260. 只出现一次的数字 III - 力扣(LeetCode)

 

 这个之前就总结过了。

先全部异或,再找从右边开始两个数不同的第一位(为1的位);通过&其补码获得,最后分两组进行异或。

class Solution {
    public int[] singleNumber(int[] nums) {
        int xorAll = 0;
        for(int x:nums){
            xorAll ^= x;
        }
        int lowBit = xorAll & -xorAll;
        int[] ans = new int[2];
        int a1 = 0, a2 = 0;
        for(int x:nums){
           if((x & lowBit) != 0){
               a1 ^= x;
           }else{
               a2 ^= x;
           }
        }
        return new int[]{a1,a2};
    }
}

342. 4的幂 - 力扣(LeetCode)

 

class Solution {
    public boolean isPowerOfFour(int n) {
        long i = 1;
        while(i < n){
            i*=4;
        }
        return i == n;
    }
}

 

371. 两整数之和 - 力扣(LeetCode)

 利用了异或运算和与运算的性质,避免使用传统的加法运算符。

class Solution {
    public int getSum(int a, int b) {
        //当进位数没有了,证明计算完成
        while (b != 0) {
            //计算不进位的数
            int tempA = a ^ b;
            //计算进位的数
            int tempB = (a & b) << 1;
            a = tempA;
            b = tempB;
        }
        return a;
    }
}

三、布隆过滤器

705. 设计哈希集合 - 力扣(LeetCode)

 这种之前哈希表已经总结过了

class MyHashSet {

    /** Initialize your data structure here. */
    boolean[] map = new boolean[1000005];
    public MyHashSet() {
        
    }
    
    public void add(int key) {
        map[key] = true;
    }
    
    public void remove(int key) {
        map[key] = false;
    }
    
    /** Returns true if this set contains the specified element */
    public boolean contains(int key) {
        return map[key] == true;
    }
}

/**
 * Your MyHashSet object will be instantiated and called as such:
 * MyHashSet obj = new MyHashSet();
 * obj.add(key);
 * obj.remove(key);
 * boolean param_3 = obj.contains(key);
 */

// class MyHashSet {

//     /** Initialize your data structure here. */
//     boolean[] map = new boolean[1000005];
//     public MyHashSet() {
        
//     }
    
//     public void add(int key) {
//         map[key] = true;
//     }
    
//     public void remove(int key) {
//         map[key] = false;
//     }
    
//     /** Returns true if this set contains the specified element */
//     public boolean contains(int key) {
//         return map[key] == true;
//     }
// }

// /**
//  * Your MyHashSet object will be instantiated and called as such:
//  * MyHashSet obj = new MyHashSet();
//  * obj.add(key);
//  * obj.remove(key);
//  * boolean param_3 = obj.contains(key);
//  */

class MyHashSet {
    private static final int BASE = 769;
    private LinkedList[] data;

    /** Initialize your data structure here. */
    public MyHashSet() {
        data = new LinkedList[BASE];
        for (int i = 0; i < BASE; ++i) {
            data[i] = new LinkedList<Integer>();
        }
    }
    
    public void add(int key) {
        int h = hash(key);
        Iterator<Integer> iterator = data[h].iterator();
        while (iterator.hasNext()) {
            Integer element = iterator.next();
            if (element == key) {
                return;
            }
        }
        data[h].offerLast(key);
    }
    
    public void remove(int key) {
        int h = hash(key);
        Iterator<Integer> iterator = data[h].iterator();
        while (iterator.hasNext()) {
            Integer element = iterator.next();
            if (element == key) {
                data[h].remove(element);
                return;
            }
        }
    }
    
    /** Returns true if this set contains the specified element */
    public boolean contains(int key) {
        int h = hash(key);
        Iterator<Integer> iterator = data[h].iterator();
        while (iterator.hasNext()) {
            Integer element = iterator.next();
            if (element == key) {
                return true;
            }
        }
        return false;
    }

    private static int hash(int key) {
        return key % BASE;
    }
}

 

706. 设计哈希映射 - 力扣(LeetCode)

class MyHashMap {
    static int n=6774;
    int[] s;
    int[] v;
    public MyHashMap() {
        s=new int[n];
        v=new int[n];
        Arrays.fill(s,n);
    }
    
    public void put(int key, int value) {
        int k=f(key);
        s[k]=key;
        v[k]=value;
    }
    
    public int get(int key) {
        int k=f(key);
        if(s[k]==n) return -1;
        return v[k];
    }
    
    public void remove(int key) {
        v[f(key)]=-1;
    }
    public int f(int x){
        int k=x%n;
        while(s[k]!=x&&s[k]!=n){
            k++;
            if(k==n) k=0;
        }
        return k;
    }
}

/**
 * Your MyHashMap object will be instantiated and called as such:
 * MyHashMap obj = new MyHashMap();
 * obj.put(key,value);
 * int param_2 = obj.get(key);
 * obj.remove(key);
 */

 

1044. 最长重复子串 - 力扣(LeetCode)

基于DC3算法的后缀数组构建,并使用后缀数组求解最长重复子串问题 

DC3算法,该算法用于构建后缀数组。后缀数组构建完成后,根据height数组找到最长的重复子串。这个还要仔细研究

class Solution {
    public static String longestDupSubstring(String s) {
        int length = s.length();
        int[] arr = new int[length];
        for (int i = 0; i < length; i++) {
            arr[i] = s.charAt(i);
        }

        DC3 dc3 = new DC3(arr);
        int[] height = dc3.getHeight();
        int[] suffix = dc3.getSuffix();
        int max = height[0];// height中的最大值
        int maxIndex = -1;// height中的最大值的下标
        for (int i = 1; i < length; i++) {
            if (height[i] > max) {
                maxIndex = i;
                max = height[i];
            }
        }

        return maxIndex == -1 ? "" : s.substring(suffix[maxIndex]).substring(0, max);
    }

    private static class DC3{
        private final int[] suffix;// 后缀数组,里面的元素按照字典序从小到大排.suffix[a]=b表示b对应的后缀排第a名
        private final int[] rank;// suffix的伴生数组,含义和suffix相反.rank[a]=b表示a对应的后缀排第b名
        private final int[] height;// height[i]表示第i名后缀和第i-1名后缀的最长公共前缀的长度,i从0开始,i表示名次

        public int[] getSuffix() {
            return suffix;
        }

        public int[] getRank() {
            return rank;
        }

        public int[] getHeight() {
            return height;
        }

        public DC3(int[] arr) {
            suffix = suffix(arr);// 求arr的后缀数组
            rank = rank(suffix);
            height = height(arr);
        }

        private int[] height(int[] arr) {
        int length = arr.length;
        int[] result = new int[length];

        for (int i = 0, value = 0; i < length; i++) {
            if (rank[i] != 0) {
                if (value > 0) {
                    value--;
                }

                int pre = suffix[rank[i] - 1];
                while (i + value < length && pre + value < length && arr[i + value] == arr[pre + value]) {
                    value++;
                }

                result[rank[i]] = value;
            }

        }

        return result;
    }

    private int[] rank(int[] suffix) {
        int length = suffix.length;
        int[] result = new int[length];

        // 将suffix数组的下标和元素值互换即可
        for (int i = 0; i < length; i++) {
            result[suffix[i]] = i;
        }

        return result;
    }

    private int[] suffix(int[] arr) {
        int max = getMax(arr);
        int length = arr.length;
        int[] newArr = new int[length + 3];
        System.arraycopy(arr, 0, newArr, 0, length);

        return skew(newArr, length, max + 1);
    }

    private int[] skew(int[] arr, int length, int num) {

        // eg:下标为0,3,6,9,12...属于s0类;下标为1,4,7,10,13...属于s1类;下标为2,5,8,11,14...属于s2类;
        int n0 = (length + 2) / 3;// s0类个数
        int n1 = (length + 1) / 3;// s1类个数
        int n2 = length / 3;// s2类个数
        int n02 = n0 + n2;// s02类的个数

        // 按照定义,n0个数要么比n1和n2多1个,要么相等.因此s12的大小用n02而不是n12是为了处理边界条件,防止数组越界判断
        int[] s12 = new int[n02 + 3];
        int[] sf12 = new int[n02 + 3];// 记录s12类的排名

        // 统计s12类下标都有哪些,放到s12中
        for (int i = 0, j = 0; i < length + (n0 - n1); i++) {
            if (i % 3 != 0) {
                s12[j++] = i;
            }
        }

        // 将s12类排序,排序结果最终会放到sf12中
        radixPass(arr, s12, sf12, 2, n02, num);// 按照"个位数"排序,结果放到sf12中
        radixPass(arr, sf12, s12, 1, n02, num);// 按照"十位数"排序,结果放到s12中
        radixPass(arr, s12, sf12, 0, n02, num);// 按照"百位数"排序,结果放到sf12中

        int rank = 0; // 记录了排名
        int ascii1 = -1, ascii2 = -1, ascii3 = -1;// 记录了3个字符的ascii码

        for (int i = 0; i < n02; i++) {
            if (ascii1 != arr[sf12[i]] || ascii2 != arr[sf12[i] + 1] || ascii3 != arr[sf12[i] + 2]) {
                rank++;
                ascii1 = arr[sf12[i]];
                ascii2 = arr[sf12[i] + 1];
                ascii3 = arr[sf12[i] + 2];
            }

            if (sf12[i] % 3 == 1) {
                s12[sf12[i] / 3] = rank;// 计算s1类的排名
            } else {// sf12[i]的值只有s1或s2类的,因此走到这里必定是s2类的
                s12[sf12[i] / 3 + n0] = rank;// 计算s2类的排名
            }
        }

        if (rank < n02) {

            sf12 = skew(s12, n02, rank + 1);// 递归调用直到有序,有序的排名结果放到sf12中
            for (int i = 0; i < n02; i++) {
                s12[sf12[i]] = i + 1;
            }
        } else {// 若s12已经有序了,则根据s12直接得到sf12即可
            for (int i = 0; i < n02; i++) {
                sf12[s12[i] - 1] = i;
            }
        }


        // 对s0类进行排序,排序结果放到sf0中
        int[] s0 = new int[n0];
        int[] sf0 = new int[n0];

        for (int i = 0, j = 0; i < n02; i++) {
            if (sf12[i] < n0) {
                s0[j++] = 3 * sf12[i];
            }
        }
        radixPass(arr, s0, sf0, 0, n0, num);

        int[] suffix = new int[length];// 记录最终排序
        for (int p = 0, t = n0 - n1, k = 0; k < length; k++) {
            int i = sf12[t] < n0 ? sf12[t] * 3 + 1 : (sf12[t] - n0) * 3 + 2;
            int j = sf0[p];

            if (sf12[t] < n0 ? abOrder(arr[i], s12[sf12[t] + n0], arr[j], s12[j / 3])
                    : abOrder(arr[i], arr[i + 1], s12[sf12[t] - n0 + 1], arr[j], arr[j + 1], s12[j / 3 + n0])) {
                suffix[k] = i;
                t++;
                if (t == n02) {
                    for (k++; p < n0; p++, k++) {
                        suffix[k] = sf0[p];
                    }
                }
            } else {
                suffix[k] = j;
                p++;
                if (p == n0) {
                    for (k++; t < n02; t++, k++) {
                        suffix[k] = sf12[t] < n0 ? sf12[t] * 3 + 1 : (sf12[t] - n0) * 3 + 2;
                    }
                }
            }
        }

        return suffix;
    }

    private void radixPass(int[] arr, int[] input, int[] output, int offset, int limit, int num) {
        int[] barrel = new int[num];// 桶

        // 统计各个桶中元素的数量
        for (int i = 0; i < limit; i++) {
            barrel[arr[input[i] + offset]]++;
        }

        for (int i = 0, sum = 0; i < num; i++) {
            int temp = barrel[i];
            barrel[i] = sum;
            sum += temp;
        }

        // 将本趟基排结果放到output中
        for (int i = 0; i < limit; i++) {
            output[barrel[arr[input[i] + offset]]++] = input[i];
        }
    }

    // 比较(x1,y1)和(x2,y2)的字典序,前者<=后者返回true
    private boolean abOrder(int x1, int y1, int x2, int y2) {
        return (x1 < x2) || (x1 == x2 && y1 <= y2);
    }

    // 比较(x1,y1,z1)和(x2,y2,z2)的字典序,前者<=后者返回true
    private boolean abOrder(int x1, int y1, int z1, int x2, int y2, int z2) {
        return (x1 < x2) || (x1 == x2 && abOrder(y1, z1, y2, z2));
    }

    // 获取数组的最大值
    private int getMax(int[] arr) {
        int max = Integer.MIN_VALUE;
        for (int i : arr) {
            max = Math.max(max, i);
        }

        return max;
    }

    }
}

 

211. 添加与搜索单词 - 数据结构设计 - 力扣(LeetCode)

class WordDictionary {
    private WordDictionary[] items;  // 数组用于存储子节点
    boolean isEnd;  // 表示当前节点是否是一个单词的结束节点

    public WordDictionary() {
        items = new WordDictionary[26];  // 初始化子节点数组
    }
    
    // 向 WordDictionary 中添加单词
    public void addWord(String word) {
        WordDictionary curr = this;
        int n = word.length();
        
        // 逐个字母遍历单词
        for (int i = 0; i < n; i++) {
            int index = word.charAt(i) - 'a';
            
            // 如果当前节点的子节点数组中没有对应字母的节点,则创建一个新的节点
            if (curr.items[index] == null) {
                curr.items[index] = new WordDictionary();
            }
            
            curr = curr.items[index];  // 继续向下遍历
        }
        
        curr.isEnd = true;  // 将单词的最后一个字母节点的 isEnd 设置为 true,表示这是一个单词的结束
    }
    
    // 搜索给定的单词
    public boolean search(String word) {
        return search(this, word, 0);
    }

    // 递归搜索单词
    private boolean search(WordDictionary curr, String word, int start) {
        int n = word.length();
        
        // 如果已经遍历完单词,判断当前节点是否是一个单词的结束节点
        if (start == n) {
            return curr.isEnd;
        }
        
        char c = word.charAt(start);
        
        // 如果当前字母不是通配符 '.',直接查找对应的子节点
        if (c != '.') {
            WordDictionary item = curr.items[c - 'a'];
            return item != null && search(item, word, start + 1);
        }

        // 如果字母是通配符 '.',遍历当前节点的所有子节点,递归调用 search 方法
        for (int j = 0; j < 26; j++) {
            if (curr.items[j] != null && search(curr.items[j], word, start + 1)) {
                return true;
            }
        }
        
        return false;
    }
}


总结

布隆过滤器这里难一点,其他都很简单,开心!

DC3算法还要去搞清楚一下。

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

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

相关文章

大反转!OpenAI董事会辞职,求奥特曼重返OpenAI?「奥特曼24小时流放」大揭秘...

大家好&#xff0c;我是二狗。 想必大家昨天都被Sam Altman被董事会解雇的事情刷屏了。 然而才仅仅过去一天&#xff0c;OpenAI 董事会就反悔了&#xff01;正和Sam Altman 商量让他重返CEO职位。 这一反转和Altman被炒鱿鱼一样突然&#xff0c;凄凄惨惨真真假假真真&#x…

SpirngBoot + Vue 前后端分离开发工具代码

✅作者简介&#xff1a;大家好&#xff0c;我是Leo&#xff0c;热爱Java后端开发者&#xff0c;一个想要与大家共同进步的男人&#x1f609;&#x1f609; &#x1f34e;个人主页&#xff1a;Leo的博客 &#x1f49e;当前专栏&#xff1a; Java从入门到精通 ✨特色专栏&#xf…

SQL练习02

1.买下所有产品的客户 SQL Create table If Not Exists Customer (customer_id int, product_key int); Create table Product (product_key int); Truncate table Customer; insert into Customer (customer_id, product_key) values (1, 5); insert into Customer (customer_…

丢掉破解版,官方免费了!!!

哈喽&#xff01;大家好。 几天不见&#xff0c;今天给大家带来一款海外的神器&#xff0c;官方宣布完全免费&#xff0c;但仅限于个人与教育用途&#xff0c;切勿商用噢&#xff01; 不要看这个软件名字普普通通&#xff0c;实际上内蕴乾坤&#xff01; 接下来看我给大家炫一…

Loguru:一个超酷的Python库

在项目中&#xff0c;了解代码运行情况至关重要&#xff0c;特别是遇到Bug需要排除问题的时候&#xff0c;而这正是日志记录发挥作用的地方。对于Python开发者来说&#xff0c;Loguru是一个简单但功能强大的日志记录库&#xff0c;它使得跟踪代码的行为变得轻松而高效。 什么是…

穿越风波,“长红”的直播电商依然扎根产业和消费者

当消费者将最后一个快递拿进家门&#xff0c;2023年的双11也就落下了帷幕。相较于往年组队、拼单的玩法&#xff0c;如今最受欢迎的双11 流程&#xff0c;或许已经变成点进自己心仪主播、店铺的直播间&#xff0c;翻阅最新的产品清单&#xff0c;从中选择购物目标&#xff0c;在…

文件钓鱼-后缀隐藏文件捆绑文件压缩释放技巧

0x00 文件钓鱼 简单说下文件样本钓鱼的目的&#xff0c;为诱导用户安装木马文件&#xff0c;达到控制或者窃取某些信息的目的&#xff0c;抛开邮件的真实性。木马的伪造是一个比较关键的点&#xff0c;下面简要说下三种木马文件伪装的技巧 0x01 水坑攻击与鱼叉攻击的概念 水坑…

Visual Studio Code 从英文界面切换中文

1、先安装中文的插件&#xff0c;直接安装。 2、点击右下角的 change language restart&#xff0c; 让软件重启即可以完成了。

影刀sqlite的插入方法

影刀sqlite的插入方法 变量外面不用加‘’

ElasticSearch学习篇6_ES实践与Lucene对比及原理分析技术分享小记

前言 QBM、MFS的试题检索、试题查重、公式转换映射等业务场景以及XOP题库广泛使用搜索中间件&#xff0c;业务场景有着数据量大、对内容搜索性能要求高等特点&#xff0c;其中XOP题库数据量更是接近1亿&#xff0c;对检索性能以及召回率要求高。目前QBM、MFS使用的搜索中间件是…

Selenium UI 自动化

一、Selenium 自动化 1、什么是Selenium&#xff1f; Selenium是web应用中基于UI的自动化测试框架。 2、Selenium的特点&#xff1f; 支持多平台、多浏览器、多语言。 3、自动化工作原理&#xff1f; 通过上图&#xff0c;我们可以注意到3个角色&#xff0c;下面具体讲解一…

三层交换机实现不同VLAN间通讯

默认时&#xff0c;同一个VLAN中的主机才能彼此通信&#xff0c;那么交换机上的VLAN用户之间如何通信&#xff1f; 要实现VLAN之间用户的通信&#xff0c;就必须借助路由器或三层交换机来完成。 下面以三层交换机为例子说明&#xff1a; 注意&#xff1a; 1.交换机与三层交换…

设计模式-行为型模式-模板方法模式

一、什么是模板模式 模板方法模式&#xff08;Template Method Pattern&#xff09;是一种行为型设计模式&#xff0c;它定义了一个算法骨架&#xff0c;允许子类在不改变算法整体结构的情况下重新定义算法的某些步骤。 主要组成部分&#xff1a; 1、模板方法&#xff08;Templ…

如何在CSDN植入广告

如何在CSDN植入广告 概述 如果你的博客访问量很大&#xff0c;你可以通过如下方式在博客上放置广告而通过博客赚钱 广告联盟 google adsense 链接&#xff1a;Adsense 比较主流的应该是Google Adsense&#xff0c;可以配置自动广告&#xff08;包含 业内广告、锚定广告、侧…

kafka 磁盘扩容与数据均衡实在操作讲解

文章目录 一、概述1&#xff09;Kafka 磁盘扩容概述2&#xff09;Kafka 数据均衡概述 二、K8s 集群部署三、kafka on k8s 环境部署1&#xff09;安装 helm2&#xff09;安装 zookeeper1、添加源并下载部署包2、修改配置3、开始安装 zookeeper4、测试验证5、卸载 3&#xff09;安…

Linux线程编程

Linux线程编程初步 一些历史背景 Linux间接起源于Unix&#xff0c;而Linux诞生时并不存在 "线程"的概念。在20世纪90年代线程才流行起来&#xff0c;POSIX Thread标准于 1995年确立。Unix中引入 Thread 之后&#xff0c;大量函数被重写&#xff0c;信号机制也变得复…

通过汇编理解cortex-m3:第0章

第0章&#xff1a;准备工作 基本想法&#xff1a;利用汇编和gdb调试&#xff0c;来学习cortex-m3汇编指令&#xff0c;以及一些寄存器的功能。 软件和硬件&#xff1a; 硬件&#xff1a;韦东山瑞士军刀中的最小核心板&#xff08;STM32F103C8T6&#xff09; STLINK-V2&#…

B-2:Linux系统渗透提权

B-2:Linux系统渗透提权 服务器场景:Server2204(关闭链接) 用户名:hacker 密码:123456 1.使用渗透机对服务器信息收集,并将服务器中SSH服务端口号作为flag提交; 使用nmap扫描,发现ssh服务端口为2283 Flag:2283 2.使用渗透机对服务器信息收集,并将服务器中…

算法之路(二)

&#x1f58a;作者 : D. Star. &#x1f4d8;专栏 : 算法小能手 &#x1f606;今日分享 : 你知道北极熊的皮肤是什么颜色的吗&#xff1f;&#xff08;文章结尾有答案哦&#xff01;&#xff09; 文章目录 力扣的209题✔解题思路✔代码:✔总结: 力扣的3题✔解题思路&#xff1a…

变频器干扰PLC,我们是这么解决的……

PLC是变频器的上位机&#xff0c;但是&#xff0c;在很多工程现场中&#xff0c;经常也会出现这样的问题&#xff0c;就是变频器开始运行后&#xff0c;PLC就开始罢工了&#xff0c;有的时候死机&#xff0c;有的时候指令传达不畅&#xff0c;有的时候会出现通讯时断时续等等&a…