AcWing 算法基础课二 数据结构 链表 栈 队列 并查集 哈希表

单链表.

AcWing. 826.单链表

import java.util.Scanner;
public class Main{
        static int[] e = new int[100010];//结点i的值
        static int[] ne = new int[100010];//结点i的next指针
        static int idx,head;//head是头结点,idx存当前已经用到了哪个点
        public static void init(){
            idx = 0;
            head = -1;
        }
    //H向链表头插入一个数x;
    public static void add_head(int x){
        e[idx] = x;
        ne[idx] = head;
        head = idx++;
    } 
    //I在第k位数后面插入一个数x
    public static void add(int k,int x){
        e[idx] = x;
        ne[idx] = ne[k];
        ne[k] = idx++;
    }
    //D删除第k个数后面得数
    public static void remove(int k){
        ne[k] = ne[ne[k]];
    }
    public static void main(String[] args){
         Scanner scan = new Scanner(System.in);
        int m = scan.nextInt();

        init();
        while(m -- > 0){
            //因为java中没有输入一个字符,所以用字符串转字符
            String s = scan.next();
            char op = s.charAt(0);

            if(op == 'H'){
                int x = scan.nextInt();
                add_head(x);
            }else if(op == 'D'){
                int k = scan.nextInt();
                if(k == 0) head = ne[head];
                else remove(k-1);
            }else {
                int k = scan.nextInt();
                int x = scan.nextInt();
                add(k-1,x);
            }
        }
        for(int i = head;i != -1;i = ne[i] ){
            System.out.print(e[i] +  " ");
        }
    }
}

双链表

AcWing 827.双链表

import java.util.Scanner;
public class Main{
    static int N = 100010;
    static int[] e = new int[N];//元素
    static int[] r = new int[N];//右指针
    static int[] l = new int[N];//左指针
    static int idx;

    //删除第k位插入的数
    public static void remove(int k){
        r[l[k]] = r[k];
        l[r[k]] = l[k];
    }
    //这是在第k位数后面插入一个数x
    public static void add_all(int k,int x){
        e[idx] = x;
        r[idx] = r[k];
        l[idx] = k;
        l[r[k]] = idx;
        r[k] = idx++;
    }
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int m = scan.nextInt();

        r[0] = 1;l[1] = 0;idx = 2;

        while(m -- > 0){
            String s = scan.next();
            char op = s.charAt(0);
            if(op == 'L'){
                int x = scan.nextInt();
                add_all(0,x);
            }else if(op == 'R'){
                int x = scan.nextInt();
                add_all(l[1],x);
            }else if(op == 'D'){
                int k = scan.nextInt();
                remove(k + 1);
            }else if(s.equals("IR")){
                int k  = scan.nextInt();
                int x = scan.nextInt();
                add_all(k + 1,x);
            }else {
                int k = scan.nextInt();
                int x = scan.nextInt();
                add_all(l[k+1],x);
            }
        }
       for(int i = r[0];i != 1; i= r[i]){
            System.out.print(e[i]  + " ");
        }
    }
}

AcWing 828.模拟栈

import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int m = scan.nextInt();
        int[] stl = new int[100010];
        int tt = 0;

        while(m -- > 0){
            String s = scan.next();

            if(s.equals("push")){
                int x= scan.nextInt();
                stl[++tt] = x;
            }else if(s.equals("pop")){
                tt--;
            }else if(s.equals("empty")){
                if(tt > 0){
                    System.out.println("NO");
                }else System.out.println("YES");
            }else{
                System.out.println(stl[tt]);
            }

        }
    }
}

AcWing 3302.表达式求值

import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        //以字符串形式输入表达式
        String s = scan.next();
        //map来添加运算符号进去,定义优先级
        Map<Character,Integer> map = new HashMap<>();
        map.put('+',1);
        map.put('-',1);
        map.put('*',2);
        map.put('/',2);

        Stack<Character> op = new Stack<>();//存运算符号
        Stack<Integer> num = new Stack<>();//存数字

        for(int i = 0 ; i < s.length(); i ++ ){
            char c = s.charAt(i);
            //判断c字符是不是数字
            if(Character.isDigit(c)){
                int x = 0,j = i;
                //数字可能会是多位数,
                while(j < s.length() && Character.isDigit(s.charAt(j))){
                    x = x * 10 + s.charAt(j) - '0';
                    j++;
                }
                num.push(x);//将数字x存入数字栈栈顶
                i = j - 1;//重新赋值i
            }else if(c == '('){
                op.push(c); // 将左括号存入字符栈栈顶
            }else if(c == ')'){
                //如果栈顶不等于左括号,一直计算下去;
                while(op.peek() != '('){
                    eval(op,num);
                }
                op.pop(); // 将左括号弹出栈顶
            }else { //如果是正常字符
                while(!op.empty() && op.peek() != '(' && map.get(op.peek()) >= map.get(c)){
                    eval(op,num);
                }
                op.push(c);
            }
        }
        while(!op.empty()) eval(op,num);
        System.out.println(num.peek());
    }
    public static void eval(Stack<Character> op,Stack<Integer> num){
        int b = num.pop();
        int a = num.pop();

        char c = op.pop();
        if(c == '+'){
           num.push(a+b);
        }else if(c == '-'){
            num.push(a-b);
        }else if(c == '*'){
            num.push(a*b);
        }else {
            num.push(a/b);
        }
    }
}

队列

AcWing 829. 模拟队列

import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int m = scan.nextInt();
        //队列是在tt队尾插入元素,队头hh弹出元素
        int[] dl = new int[100010];
        int hh = 0;
        int tt = -1;
        while(m -- > 0){
            String s = scan.next();
            if(s.equals("push")){
                int x = scan.nextInt();
                dl[++tt] =  x;
            }else if(s.equals("pop")){
                hh++;
            }else if(s.equals("empty")){
                if(hh <= tt) System.out.println("NO");
                else System.out.println("YES");
            }else {
                System.out.println(dl[hh]);
            }
        }
    }
}

单调栈

AcWing 830.单调栈

import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] stk  = new int[100010];
        int tt = 0;

        for(int i = 0 ; i < n ;  i++ ){
            int x = scan.nextInt();
            //如果栈非空 ,栈顶元素>= x,那么说明栈顶这个数不满足需求,
            //因为比较的是左边第一个最近最小的数,所以就把stk[tt]弹出了;
            while(tt!=0 && stk[tt] >= x){
                tt--;
            }
            //如果弹出操作完了之后,栈不是空的,就输出栈顶元素,
            if(tt != 0) System.out.print(stk[tt]+" ");
            //否则就是栈是空的,输出-1
            else System.out.print("-1" + " ");
            //最后将x插入栈顶;
            stk[++tt] = x;
        }
    }
}

单调队列

AcWing 154.滑动窗口

import java.io.*;
public class Main{
    static int N = 1000010;
    static int n,k;//数组长度 和 滑动窗口长度
    static int hh,tt;//队头队尾
    static int[] q = new int[N];//q是队列 存的是 下标
    static int[] a = new int[N];
    public static void main(String[] args)throws IOException{
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter wt = new PrintWriter(new OutputStreamWriter(System.out));
        String[] st = bf.readLine().split(" ");
        n = Integer.parseInt(st[0]);
        k = Integer.parseInt(st[1]);
        String[] str = bf.readLine().split(" ");
        for(int i = 0 ; i < n ; i ++ ) a[i] = Integer.parseInt(str[i]);

        hh = 0;tt = - 1;//队头队尾 感觉像双指针
        for(int i = 0 ; i < n ; i ++ ){//i是 滑动窗口的 终点
            //队列非空 hh <= tt且 队头在起点之前 就出栈
            if(hh <= tt && q[hh] < i - k + 1) hh ++;//起点:i-k+1
            //这个while 就是 控制 这个队列的单调性递增!
            //非空 & 队尾元素 >= 新加进来的元素,就将队尾删掉,因 队头存的是窗口中最小的
            while(hh <= tt && a[q[tt]] >= a[i]) tt --;  //求最小值所以保留最小值
            q[++ tt] = i;//当前 位置插到 队尾
            //不足k 不用判断 
            if(i >= k - 1) wt.print(a[q[hh]] + " ");
        }
        wt.println();
        hh = 0;tt = -1;
        for(int i = 0 ; i < n ; i ++){
            if(hh <= tt && q[hh] < i - k + 1) hh ++;
            while(hh <= tt && a[q[tt]] <= a[i]) tt --;//求最大值所以保留最大值

            q[++ tt] = i;
            if(i >= k - 1) wt.print(a[q[hh]] + " ");
        }
        wt.flush();//记得刷新流
    }
}

KMP

AcWing 831. KMP字符串

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Scanner;
public class Main{
    static int N = 100010;
    static int ne[] = new int[N];//kmp核心数组next[];
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Integer n = Integer.parseInt(br.readLine());//输入p字符的长度
        String s1 = " " + br.readLine();//输入p字符串
        Integer m = Integer.parseInt(br.readLine());
        String s2 = " " + br.readLine();
        char[] a1 = s1.toCharArray();//创建p数组 存字符
        char[] a2 = s2.toCharArray();
        /**
         * ne[]:存储一个字符串以每个位置为结尾的‘可匹配最长前后缀’的长度。
         * next[i]=j 等价 p[1,j]=p[i-j+1,i]
         * 构建ne[]数组:
         *              1,初始化ne[1] = 0,i从2开始。当第一个数时就是0所以不用参与。默认是0;
         *              2,若匹配,s[i]=s[j+1]说明1~j+1是i的可匹配最长后缀,ne[i] = ++j;
         *              3,若不匹配,则从j的最长前缀位置+1的位置继续与i比较
         *              (因为i-1和j拥有相同的最长前后缀,我们拿j的前缀去对齐i-1的后缀),
         *              即令j = ne[j],继续比较j+1与i,若匹配转->>2
         *              4,若一直得不到匹配j最终会降到0,也就是i的‘可匹配最长前后缀’的长度
         *              要从零开始重新计算
         */
        for(int i = 2,j = 0;i <= n ;i++) {
            //这里判断从j是不是>=0,如果< 0,表示还没有前缀和后缀相等
            while(j!=0&&a1[i]!=a1[j+1]) j = ne[j]; //不相等就让j等于上一个数的next[];
            if(a1[i]==a1[j+1]) j++;//匹配 有一个相等,前缀和后缀相等长度为1.
            ne[i] = j;
        }
        /**
         * 匹配两个字符串:
         *      1,从i=1的位置开始逐个匹配,利用ne[]数组减少比较次数
         *      2,若i与j+1的位置不匹配(已知1~j匹配i-j~i-1),
         *      j跳回ne[j]继续比较(因为1~j匹配i-j~i-1,所以1~ne[j]也能匹配到i-ne[j]~i-1)
         *      3,若匹配则j++,直到j==n能确定匹配成功
         *      4,成功后依然j = ne[j],就是把这次成功当成失败,继续匹配下一个位置
         */
        for(int i = 1,j = 0; i <= m;i++) {
            while(j!=0&&a2[i]!=a1[j+1]) j = ne[j];
            if(a2[i]==a1[j+1]) j++;
            if(j==n) {//相等的数= 短的数组的长度,就说明该输出了
                j = ne[j];//输出之后,要继续往下面遍历对比,所以让j=上一个数的缀长度,
                bw.write(i-n+" ");
            }
        }
        /**
         * 时间复杂度:
         *      因为:j最多加m次,再加之前j每次都会减少且最少减一,j>0
         *      所以:while循环最多执行m次,若大于m次,j<0矛盾
         *      最终答案:O(2m)
         */
        //所有write下的内容,会先存在writers中,当启用flush以后,会输出存在其中的内容。
        //如果没有调用flush,则不会将writer中的内容进行输出。
        bw.flush();
    }
}

Trie:高效地存储和查找字符串集合的数据结构

AcWing 835. Trie字符串统计

import java.util.Scanner;
public class Main{
    static int N = 100010,idx = 0;//idx是当前用到的下标
    static int[][] song = new int[N][26];//每个点的儿子集合最多26个字母儿子
    static int[] cnt  = new int[N];//存当前结尾的单词有多少个
    static char[] str = new char[N];
    //插入字符串
    public static  void insert(char[] str){
        int p = 0; //下标0表示头结点,根节点
        for(int i = 0 ; i < str.length; i ++ ){
            // 将字符串每个字符a-z 映射成数字;0-25
            int u = str[i] - 'a'; 
            //如果这个儿子分支没有字符,说明这条分支还没有这个字符插入过
            //就创建出来 把【idx】下标赋值上去,作为每个分支的专属坐标
            if(song[p][u] == 0) song[p][u] = ++idx;
            //然后将p往下前进一层
            p = song[p][u];
        }
        //最后停在那一层的那个数字就做标记,说明这是要找的字符串的结尾
        cnt[p]++;
    }
    public static int query(char[] str){
        int p = 0;//从根节点开始,下标是0表示根节点,头结点
        for(int i = 0 ; i < str.length; i ++){
            int u = str[i] - 'a'; // 将字符串每个字符都转化成数字0-25
            //如果这个点上没有标记,就说明没有存入过这个字符,所以返回0
            if(song[p][u] == 0) return 0;
            //如果这个点上面能寻找到这个字符,就让他往下一层继续寻找;
            p = song[p][u];
        }
        //最后查找完之后输出最后一个做标记的点为下标的cnt数组的值。
        return cnt[p];
    }
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String sss = scan.nextLine();
        while(n -- > 0){
            String s = scan.nextLine();
            String[] st = s.split(" ");
            String s1 = st[0];
            String s2 = st[1];
            if(s1.equals("I")){
                insert(s2.toCharArray());
            }else{
                System.out.println(query(s2.toCharArray()));
            }
        }
    }
}

AcWing 143. 最大异或对

import java.io.*;
public class Main{
    static int N = 3100010,idx = 0;
    static int[][] song = new int[N][2];
    //插入
    public static void add(int x){
        int p = 0;//从头结点开始
        for(int i = 30 ; i >= 0 ; i -- ){ //从第31位开始遍历
            int u = x >> i & 1;//取出第i位的二进制数
            //判断这一层是空的,就创建,然后赋值下标
            if(song[p][u] == 0) song[p][u] = ++idx;
            //我觉得这个idx不是代表1或0,二维数组的u才代表这一条路的节点数字
            p = song[p][u];//然后让往下前进一层
        }
    }
    //查询
    public static int query(int x){
        int p = 0,res = 0;//从根节点0开始;res存的是这条路径表示的数
        for(int i = 30; i>= 0 ; i --){
            int u = x >> i & 1; //取出第i位的二进制数
//如果该节点的u是0,则判断一下在这一层有没有跟他相反的0,这样方便找最大异或值
            if(song[p][1-u] != 0){ 
                res += (1 << i);//res就将该二进制位对应异或之后的最优解1每一位顺次加起来。因为是异或相反数就是1,这是最优解
                p = song[p][1-u];//然后往最优解那边前进一层。
            }else{//否则就没有 最优解的0匹配1,1匹配0,所以就异或之后的值是0
                //res += (0 << i);因为是0所以可以省略,
                p = song[p][u];//然后让他往不优解那边前进一层。
            }
        }
        return res;//最后返回异或之后的最大值res
    }
    public static void main(String[] args)throws IOException{
        BufferedReader re = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter wt = new BufferedWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(re.readLine());
        String[] s = re.readLine().split(" ");
        for(int i = 0 ; i < n ; i ++ ){
            add(Integer.parseInt(s[i]));
        }
        int res  = 0;
        for(int i = 0 ; i < n ; i ++ ){
            //因为输入的是字符串所以需要转成整形。然后每一次比较res的值谁大,然后将最大值重新赋值给res
            res = Math.max(res,query(Integer.parseInt(s[i])));
        }
        wt.write(res +" ");//最后输出res,因为快输出输出的是字符串,所以需要在后面加上“ ”;
        wt.close();
    }
}

并查集

AcWing 836.合并集合

import java.io.*;

public class Main {
    private static int[] p = new int[(int) 10e5];

    private static int find(int x) {
        if (p[x] != x) p[x] = find(p[x]);
        return p[x];
    }

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] s = reader.readLine().split(" ");
        int n = Integer.parseInt(s[0]), m = Integer.parseInt(s[1]);
        for (int i = 0; i < n; i++) {
            p[i] = i;
        }
        while (m-- > 0) {
            s = reader.readLine().split(" ");
            if ("Q".equals(s[0])) {
                int x = Integer.parseInt(s[1]);
                int y = Integer.parseInt(s[2]);
               writer.write(find(x) == find(y) ? "Yes\n" : "No\n");
            } else {
                int x = Integer.parseInt(s[1]);
                int y = Integer.parseInt(s[2]);
                p[find(x)] = find(y);
            }
        }
          writer.flush();
    }
}

AcWing 837. 连通块中点的数量

import java.io.*;

public class Main {
    private static int[] p = new int[(int) 10e5];

    private static int find(int x) {
        if (p[x] != x) p[x] = find(p[x]);
        return p[x];
    }

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] s = reader.readLine().split(" ");
        int n = Integer.parseInt(s[0]), m = Integer.parseInt(s[1]);
         int[] size = new int[n];
        for (int i = 0; i < n; i++) {
            p[i] = i;
            size[i]=1;
        }
        while (m-- > 0) {
            s = reader.readLine().split(" ");
            if ("Q1".equals(s[0])) {//是否在同一块内
                int x = Integer.parseInt(s[1]);
                int y = Integer.parseInt(s[2]);
               writer.write(find(x) == find(y) ? "Yes\n" : "No\n");
            } else if ("Q2".equals(s[0])) {//同一块内有多少节点
                int x = Integer.parseInt(s[1]);
               writer.write(size[find(x)]+"\n");
            } 
            else {
                int x = Integer.parseInt(s[1]);
                int y = Integer.parseInt(s[2]);
                if(find(x) == find(y) ) continue;
                size[find(y)]+=size[find(x)];//别加反了
                p[find(x)] = find(y);
            }
        }
          writer.flush();
    }
}

AcWing 240.食物链

AcWing 838.堆排序

import java.io.*;
public class Main{
    static int[] h=new int[100010];
    static int size;
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] s = reader.readLine().split(" ");
        int n = Integer.parseInt(s[0]), m = Integer.parseInt(s[1]);
         s = reader.readLine().split(" ");
        for (int i = 1; i <= n; i++) {
            h[i]=Integer.parseInt(s[i-1]);
        //  writer.write(h[i]+"\n");
        } 
        
        size=n;
        for(int i=n/2;i>0;i--){
           down(i);
        }
         while(m-->0) {
            writer.write(h[1]+" ");
            h[1]=h[size];
            size--;
            down(1);
        } 
        writer.flush();
    }
    public static void down(int u){
        int t=u;
        if(u*2<=size&&h[u*2]<h[t]) t=u*2;
        if(u*2+1<=size&&h[u*2+1]<h[t]) t=u*2+1;
        if(t!=u){
            int tem=h[t];
            h[t]=h[u];
            h[u]=tem;
            down(t);
        }
    }
}

AcWing 839.模拟堆

哈希表

数据范围是1e9,所以需要先% 再加 再%

AcWing 840.模拟散列表

拉链法(数组+单链表)

import java.io.*;
import java.util.Arrays;
public class Main{
    static int N=100003,idx=0;
    static int[] h=new int[N];
    static int[] e=new int[N];
    static int[] ne=new int[N];

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] s = reader.readLine().split(" ");
        int n = Integer.parseInt(s[0]);
        
        //数组赋初始值
        Arrays.fill(h, -1);
        while(n-->0){
            s = reader.readLine().split(" ");
            int x=Integer.parseInt(s[1]);
            if("I".equals(s[0])) {//插入
                insert(x);
            }else{
                if( find(x) )
                    writer.write("Yes\n");
                else  writer.write("No\n");
            }
        } 
        writer.flush();
        
    }
    public static void insert (int x){
        int k=(x%N+N)%N;
        e[idx]=x;
        ne[idx]=h[k];
        h[k]=idx++;
    }
    
     public static boolean find (int x){
        int k=(x%N+N)%N;
        for(int i=h[k];i!=-1;i=ne[i]){
            if(e[i]==x){
                return true; 
            }
        }
        return false;
    }
}

开放寻址法(蹲坑法)直接一个数组模拟蹲坑

AcWing 841.字符串哈希 :快速判断两个字符串是否相等

unsigned long long 是2^64次 代替了%Q,溢出时相当于 自动取模

import java.util.Scanner ;
public class Main{
    //开long型数组,本来是 前缀hash求完之后 % 2的64次方来避免 冲突,可能超过我们给的数组大小
    static int N = 100010,P = 131;//p是进制数,经验值
    static long[] h = new long[N];// 存放hash前缀值
    static long[] p = new long[N];// 存放p的n次方
    public static long get(int l,int r){
        //求l-r区间的hash值,要用h[r] - h[l-1] 位数不同需要让h[l-1]向左边移到跟h[r]对齐
        //如求1234的3-4区间位,1234 - 12,12左移然后就让12*10^(4-3+1)=1200, 相减= 34
        //本题是p进制,需要将上行公式中的10换成p就行
        //h[0] = 0
        //h[1] = h[i-1] * P + str[1] = 0*P+a = a
        //h[2] = a * P + b
        //h[3] = (a*P+b)*P+c = a*p[2]+b*P+c
        //h[4] = (a*p[2]+b*P+c)*P+d = a*p[3]+b*p[2]+c*P+d
        //比如abcd求3-4区间位,就是让h[d]-h[b],h[b]位数不用需要向左移对齐h[d],
        //h[2]*P^(4-3+1)=(a*P+b)*P^2 = a*P^3+b*P^2
        //然后 h[d] - h[b] 求34区间值,(a*p[3]+b*p[2]+c*P+d) - (a*P^3+b*P^2) = c*P+d
        return h[r] - h[l-1]*p[r-l+1];
    }
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        String s = scan.next();

        p[0] = 1;//p的0次方=1
        for(int i = 1 ; i <= n ; i++ ){
            p[i] = p[i-1] * P;//每一个下标对应P的多少次方
            //预处理公式 前缀哈希的值,P进制,中间*P    
            h[i] = h[i-1] * P + s.charAt(i-1);
        }

        while(m -- > 0){
            int l1 = scan.nextInt();
            int r1 = scan.nextInt();
            int l2 = scan.nextInt();
            int r2 = scan.nextInt();
            //判断两个区间是不是相同,用get的方法返回值一样说明区间的hash值是一样的
            if(get(l1,r1) == get(l2,r2)) System.out.println("Yes");
            else System.out.println("No");
        }
    }
}

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

thinkphp6 验证码验证结果失败,可能是session开启位置错了!!!

搞了一下下午&#xff0c;始终提示验证码不正确 然后百度得到的结果都是&#xff1a;开启session&#xff0c;但是我开启了就是管用 <?php // 全局中间件定义文件 return [// 全局请求缓存// \think\middleware\CheckRequestCache::class,// 多语言加载// \think\middle…

【前端设计】使用Verdi查看波形时鼠标遮住了parameter值怎么整

盆友&#xff0c;你们在使用Verdi的时候&#xff0c;有没有遇到过鼠标遮挡着了parameter数值的场景&#xff1f;就跟下面这个示意图一样&#xff1a; 最可恨的是这个参数值他会跟着你的鼠标走&#xff0c;你想把鼠标移开看看看这个例化值到底是多大吧&#xff0c;这个数他跟着你…

单线程与多线程的理解与学习(入门到深入)

文章目录 一、在Java中&#xff0c;有多种方式可以创建线程。以下是几种常用的方法&#xff1a;二、线程的调度线程的调度分为两种调度模型分时调度模型抢占式调度模型 三、线程传值四、什么是线程同步五、线程安全六、线程的同步机制七、线程控制 一、在Java中&#xff0c;有多…

8.4Java EE——基于注解的AOP实现

Spring AOP的注解 元素 描述 Aspect 配置切面 Pointcut 配置切点 Before 配置前置通知 After 配置后置通知 Around 配置环绕方式 AfterReturning 配置返回通知 AfterThrowing 配置异常通知 下面通过一个案例演示基于注解的AOP的实现&#xff0c;案例具体实现…

全志F1C200S嵌入式驱动开发(调整cpu频率和dram频率)

【 声明:版权所有,欢迎转载,请勿用于商业用途。 联系信箱:feixiaoxing @163.com】 f1c200s默认的cpu频率是408M,默认的dram频率是156M。这两个数值,坦白说,都算不上特别高的频率。因为我们的晶振是24M输入,所以408/24=17,相当于整个cpu的频率只是晶振倍频了17…

node.js 爬虫图片下载

主程序文件 app.js 运行主程序前需要先安装使用到的模块&#xff1a; npm install superagent --save axios要安装指定版,安装最新版会报错&#xff1a;npm install axios0.19.2 --save const {default: axios} require(axios); const fs require(fs); const superagent r…

别在找git报错的解决方案啦,多达20条git错误解决方案助你学习工作

1. 找不到Git命令 $ sudo apt-get update $ sudo apt-get install git2. 无法克隆远程仓库 $ git clone https://github.com/username/repo.git3. 无法拉取或推送到远程仓库 $ git pull origin master $ git add . $ git commit -m "Resolve conflicts" $ git pus…

StableDiffusion 换脸实现

先看效果&#xff1a; 想要换的脸&#xff1a; 想要把脸放到的目标图片&#xff1a; 实现方案&#xff1a; StableDiffusionroop&#xff08;本次实验基于roopV0.02版本&#xff09; 1/安装SD&#xff0c;模型选择 DreamShaper,Sampler使用 Euler a 2/安装roop插件 roop插…

【隐式动态求解】使用非线性纽马克方法的隐式动态求解研究(Matlab代码实现)

&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️&#x1f4a5;&#x1f4a5; &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&a…

【ARM Coresight 系列文章 10.2 - ARM Coresight STM Trace packets】

文章目录 Trace protocolpacket的种类Error packetsVERSION Packets同步 packet 上篇文章&#xff1a;ARM Coresight 系列文章 10.1 - ARM Coresight STM 介绍及使用 下篇文章&#xff1a;ARM Coresight 系列文章 10.3 - ARM Coresight STM 寄存器介绍 及STM DMA 传输介绍 Trac…

【数据结构】树状数组和线段树

树状数组和线段树 下文为自己的题解总结&#xff0c;参考其他题解写成&#xff0c;取其精华&#xff0c;做以笔记&#xff0c;如有描述不清楚或者错误麻烦指正&#xff0c;不胜感激&#xff0c;不喜勿喷&#xff01; 树状数组 需求&#xff1a; 能够快速计算区间和保证在修改…

CSS背景虚化

.mark{background-color: rgba(0,0,0,.1);-webkit-backdrop-filter: blur(3px);backdrop-filter: blur(3px); }backdrop-filter CSS 属性可以让你为一个元素后面区域添加图形效果&#xff08;如模糊或颜色偏移&#xff09;。 因为它适用于元素背后的所有元素&#xff0c;为了看…

到底什么是前后端分离

目录 Web 应用的开发主要有两种模式&#xff1a; 前后端不分离 前后端分离 总结 Web 应用的开发主要有两种模式&#xff1a; 前后端不分离 前后端分离 理解它们的区别有助于我们进行对应产品的测试工作。 前后端不分离 在早期&#xff0c;Web 应用开发主要采用前后端不…

【C#】并行编程实战:异步流

本来这章该讲的是 ASP .NET Core 中的 IIS 和 Kestrel &#xff0c;但是我看了下这个是给服务器用的。而我只是个 Unity 客户端程序&#xff0c;对于服务器的了解趋近于零。 鉴于我对服务器知识和需求的匮乏&#xff0c;这里就不讲原书&#xff08;大部分&#xff09;内容了。本…

前端面试题 —— Vue (二)

目录 一、过滤器的作用&#xff0c;如何实现一个过滤器 二、v-model 是如何实现的&#xff0c;语法糖实际是什么&#xff1f; 三、$nextTick 原理及作用 四、Vue 中给 data 中的对象属性添加一个新的属性时会发生什么&#xff1f;如何解决&#xff1f; 五、简述 mixin、ex…

【C# 数据结构】Heap 堆

【C# 数据结构】Heap 堆 先看看C#中有那些常用的结构堆的介绍完全二叉树最大堆 Heap对类进行排序实现 IComparable<T> 接口 对CompareTo的一点解释 参考资料 先看看C#中有那些常用的结构 作为 数据结构系类文章 的开篇文章&#xff0c;我们先了解一下C# 有哪些常用的数据…

【防火墙】iptables防火墙(一)

防火墙具有隔离功能 主要部署在网络边缘或者主机边缘&#xff0c;防火墙的主要作用是决定哪些数据可以被外网访问&#xff0c;哪些数据可以进入内网访问 网络层&#xff08;路由器&#xff09;&#xff1a;数据的转发 安全技术 1.入侵监测系统&#xff1a;在检测到威胁&…

城市气象数据可视化:洞察气候变化,构建智慧城市

随着城市化进程的加速&#xff0c;城市气象数据的采集和分析变得越来越重要。气象数据不仅影响着人们的生活和出行&#xff0c;还与城市的发展和规划息息相关。在数字化时代&#xff0c;如何将城市中各个气象数据进行可视化&#xff0c;让复杂的数据变得简单易懂&#xff0c;成…

全国大学生数据统计与分析竞赛2021年【本科组】-B题:用户消费行为价值分析

目录 摘 要 1 任务背景与重述 1.1 任务背景 1.2 任务重述 2 任务分析 3 数据假设 4 任务求解 4.1 任务一&#xff1a;数据预处理 4.1.1 数据清洗 4.1.2 数据集成 4.1.3 数据变换 4.2 任务二&#xff1a;对用户城市分布情况与分布情况可视化分析 4.2.1 城市分布情况可视化分析 4…

微信小程序客服系统-对接消息推送-对接模板订阅消息-嵌入webview客服链接

想要给自己的小程序增加客服系统功能 小程序客服对接导自己的系统等需求&#xff0c;可以参照我开发的客服系统&#xff0c;实现私有化部署搭建对接的微信小程序 小程序消息推送对接 首先登录小程序后台在小程序后台>开发管理>开发设置>服务器域名部分&#xff0c;配置…
最新文章