最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

java:無法訪問org.springframework.boot.SpringApplication的解決方法

 更新時間:2023年01月29日 16:25:10   作者:極客李華  
這篇文章主要給大家介紹了關(guān)于java:無法訪問org.springframework.boot.SpringApplication的解決方法,文中通過實例代碼將解決的辦法介紹的非常詳細,需要的朋友可以參考下

報錯信息如下:

java: 無法訪問org.springframework.boot.SpringApplication
錯誤的類文件: /C:/Users/11848/.m2/repository/org/springframework/boot/spring-boot/3.0.0/spring-boot-3.0.0.jar!/org/springframework/boot/SpringApplication.class
類文件具有錯誤的版本 61.0, 應(yīng)為 52.0
請刪除該文件或確保該文件位于正確的類路徑子目錄中。

解決辦法:

這個錯誤的原因是idea默認的spring-boot-starter-parent版本是3.0,改成2.7.6或者更低版本就可以了

合并集合

一共有 n 個數(shù),編號是 1∼n,最開始每個數(shù)各自在一個集合中。

現(xiàn)在要進行 m 個操作,操作共有兩種:

M a b,將編號為 a 和 b 的兩個數(shù)所在的集合合并,如果兩個數(shù)已經(jīng)在同一個集合中,則忽略這個操作;

Q a b,詢問編號為 a 和 b 的兩個數(shù)是否在同一個集合中;

輸入格式

第一行輸入整數(shù) n 和 m。

接下來 m 行,每行包含一個操作指令,指令為 M a b 或 Q a b 中的一種。

輸出格式

對于每個詢問指令 Q a b,都要輸出一個結(jié)果,如果 a 和 b 在同一集合內(nèi),則輸出 Yes,否則輸出 No。

每個結(jié)果占一行。

數(shù)據(jù)范圍

1≤n,m≤105

輸入樣例:

4 5
M 1 2
M 3 4
Q 1 2
Q 1 3
Q 3 4

輸出樣例:

Yes
No
Yes

提交代碼

#include<iostream>
using namespace std;

const int N = 100010;
int n, m;
int p[N];

int find(int x)                 // 找到x的祖先節(jié)點
{
    if (p[x] != x) p[x] = find(p[x]);
    return p[x];
}

int main()
{
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; ++i) p[i] = i;
    
    while (m--)
    {
        char op;
        int a, b;
        scanf (" %c%d%d", &op, &a, &b);
        if (op == 'M') p[p[find(a)]] = find(b);        // 讓a的祖先節(jié)點指向b的祖先節(jié)點
        else
        {
            if (find(a) == find(b)) puts("Yes");
            else puts("No");
        }
    }
    return 0;
}
import java.io.*;

public class Main
{
    static int N = 100010;
    static int n, m;
    static int [] p = new int [N];
    
    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));   
        String [] str = reader.readLine().split(" ");
        n = Integer.parseInt(str[0]);
        m = Integer.parseInt(str[1]);
        
        for (int i = 1; i <= n; ++ i) p[i] = i;
        while (m -- > 0)
        {
            String op;
            int a, b;
            str = reader.readLine().split(" ");
            op = str[0];
            a = Integer.parseInt(str[1]);
            b = Integer.parseInt(str[2]);
            if (op.equals("M")) p[find(a)] = find(b);
            else 
            {
                if (find(a) == find(b)) System.out.println("Yes");
                else System.out.println("No");
            }
        }
    }
}

總結(jié)

到此這篇關(guān)于java:無法訪問org.springframework.boot.SpringApplication解決的文章就介紹到這了,更多相關(guān)java無法訪問org.springframework.boot.SpringApplication內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

巍山| 鄯善县| 吉林市| 固原市| 宁陵县| 孝义市| 鄄城县| 洞口县| 海安县| 砚山县| 台北市| 合肥市| 长寿区| 抚宁县| 逊克县| 滨州市| 莱西市| 新泰市| 上林县| 三穗县| 响水县| 固镇县| 长葛市| 会同县| 潞西市| 南靖县| 福州市| 界首市| 博野县| 冕宁县| 铜鼓县| 溧阳市| 尉犁县| 当涂县| 左权县| 哈巴河县| 新绛县| 敦煌市| 普定县| 余江县| 隆昌县|