[2023-04-02 02:47:26,018] 아티팩트 @@@@:war exploded: 아티팩트 배포 중 오류가 발생했습니다. 자세한 내용은 서버 로그를 참조하세요.

Caused by: java.lang.IllegalStateException: 자식 컨테이너를 시작하는 중 오류 발생

Caused by: java.lang.NoClassDefFoundError: org/springframework/core/env/EnvironmentCapable

 

java.lang.ClassNotFoundException: org.springframework.core.env.EnvironmentCapable

 

해결책 ->spring-core-xxx.RC1.jar를 모듈설정열기>라이브러리>메이븐에서 다운로드받는다.

 

적용후 다시배포후 톰캣실행하면 정상동작.

 

사용한 IDE:InteilliJ

'Spring' 카테고리의 다른 글

redirect / forward  (0) 2023.02.26
Property와 Constructor  (0) 2023.02.26
Spring MVC?  (0) 2023.02.26

출력하고자 하는값(ans)을 -1로 초기화한다.

범위내에서 루프를 이용하여 r포인터를 k개가 될때까지 옮겨준다.

(k개 이상의 가장작은 연속 인형들 집합크기 라고 하였으므로 최소가 되려면 k개가 되었을때 길이를 뽑으면 된다.)

r포인터를 옮겼을때 라이언이면 cnt증가,

cnt가 k가 되면 출력하고자하는값(ans)을 갱신시키고

l이 1로 오게되면 

l이 당겨졌기때문에 l값에 해당하는 cnt를 감소시켜준다.

l이 오고나서 cnt가 변경되서 r도 움직이고 다시 cnt가 k가 되서 ans가 갱신되고

ans 를 출력하면 된다.

 

public class p15565 {
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static int n,k,l,r;
    static long ans;
    static int[] a;
    static int cnt;
    static void frame() throws IOException {
        st = new StringTokenizer(br.readLine(), " ");
        n = Integer.parseInt(st.nextToken());
        k = Integer.parseInt(st.nextToken());
        a = new int[n + 1];
        st = new StringTokenizer(br.readLine(), " ");
        for (int i = 1; i <= n; i++) {
            a[i] = Integer.parseInt(st.nextToken());
        }
    }
    static void execute(){
        ans=-1;cnt=0;
        for (int l=1,r=0; l<=n; l++){
            while(r+1<=n && cnt<k)
            {
                r++;
                if(a[r]==1) {
                    cnt++;
                }
            }
            if(cnt==k){
                if(ans==-1) ans=r-l+1;
                ans=Math.min(ans,r-l+1);
            }
            if(a[l]==1) cnt--;
        }
        System.out.println(ans);
    }

    public static void main(String[] args) throws IOException{
        frame();
        execute();
    }
}

 

 

'백준 문제풀이' 카테고리의 다른 글

백준 2230번 수 고르기  (0) 2023.03.26

먼저 오름차순으로 정렬한다.

가장 작은 차이를 구하라고 했으므로,

<차이의 절대값>의 [최소값]을 구하면된다.

최소값을 갱신시켰으면, r포인터를 이동시켜주고(조건을 만족할때까지 구하기위해서)

조건이 차이가 원하는 m값이상일때 최소값을 구해야하므로,

오름차순으로 구했기때문에,

조건을 만족시키면 구하자마자 뽑고 break;로 종료시켜준다.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;


public class p2230 {
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static int n,m,l,r;
    static int[] a;

    static void frame() throws IOException{
        st=new StringTokenizer(br.readLine()," ");
        n=Integer.parseInt(st.nextToken());
        m=Integer.parseInt(st.nextToken());
        a=new int[n+1];
        for (int i=1; i<=n; i++){
            a[i]=Integer.parseInt(br.readLine());
        }
    }

    static void execute(){
        Arrays.sort(a,1,n+1);
        int best_minus=Integer.MAX_VALUE;
            for (int l=1,r=0; l<=n; l++){
                int minus=a[l]-a[r];
                    if (Math.abs(minus)< best_minus) {
                        best_minus = minus;
                        r++;
                    }
                    if(minus>=m){
                        System.out.println(minus);
                        break;
                    }
            }
        }



    public static void main(String[] args) throws IOException {
        frame();
        execute();
    }
}

 

 

 

 

 

 

'백준 문제풀이' 카테고리의 다른 글

백준 15565번 문제  (0) 2023.03.27

메모장에 알고리즘을 구현해보았다.

 

후....통과....!

import java.util.*;
class Solution {
    static int[][] direction={{-1,0},{0,1},{1,0},{0,-1}};//동서남북 
	static int[][] maps,root;
    static int n,m;
    public void BFS() {
		Queue<int[]> q=new LinkedList<>();
		q.offer(new int[]{0,0});
		root[0][0]=1;
		while(!q.isEmpty()) {
			int[] remove=q.poll();
			int x=remove[0];
            int y=remove[1];
			for(int i=0; i<4; i++) {//동서남북
				int nx=x+direction[i][0];
				int ny=y+direction[i][1];
                if(nx<0 || nx>=n || ny<0 || ny>=m) continue;
				if(root[nx][ny]==0 && maps[nx][ny]==1) {
					maps[nx][ny]=0;
					q.offer(new int[]{nx,ny});
					root[nx][ny]=root[x][y]+1;
				}
			}
		}
	}
    public int solution(int[][] maps) {
        int answer = 0;
        n=maps.length;
        m=maps[0].length;
        root=new int[n][m];
        this.maps=maps;
        BFS();
		answer=maps[n-1][m-1]==1?-1:root[n-1][m-1];
        return answer;
    }
}

'프로그래머스 코딩테스트' 카테고리의 다른 글

타겟 넘버  (0) 2023.02.25
위장  (0) 2023.02.24
전화번호 목록  (0) 2023.02.23
완주하지 못한 선수  (0) 2023.02.23
폰켓몬  (0) 2023.02.23

redirect는 '떠넘기기'이다.
본인이 해야할일을 다른사람에게 떠넘기는것이다.
클라이언트에서 요청이 들어오면 본인이 하지않고 다른사람에게 요청한다.
그래서 요청이2번이고 요청이 2번이니 응답도 2번일수밖에없다.
반면 비슷한개념인
forward는 '전달'이라고 볼수있다.
길과 길사이의 다리역활을 하는것이다.
클라이언트에서 요청이들어오면 요청을 요약하여 해당내용을 다루는 서버에 내용을 전달한다. forward는 요청이 1번이다.
forward를 하는건 InternalResourceView이다.

'Spring' 카테고리의 다른 글

org.springframework.core.env.EnvironmentCapable 오류  (0) 2023.04.02
Property와 Constructor  (0) 2023.02.26
Spring MVC?  (0) 2023.02.26

Property태그가 나오면 set메소드를 필요로하고,
Constructor태그가 나오면 생성자메소드를 필요로한다.

생성자메소드만들시 앞에 기본생성자를 꼭 써주는것은 기본.

 

'Spring' 카테고리의 다른 글

org.springframework.core.env.EnvironmentCapable 오류  (0) 2023.04.02
redirect / forward  (0) 2023.02.26
Spring MVC?  (0) 2023.02.26

MVC에서 M은 Model V은 View C은 Controller의 약자이다.
M 즉, Model은 DB라고 보면된다.
C 즉, Controller는 회사내로보면 팀장이나 프로젝트 PM이다.
M을 받아서 어떻게 할지 방향을 제시한다.
V은 View 이고 받은 M을 보기좋게 꾸미는 ui라고 볼수있다.
이 MVC는 같이 협업할때 훌륭한 성과물이 나오기때문에 MVC패턴이라고 이름지은듯 하다.

'Spring' 카테고리의 다른 글

org.springframework.core.env.EnvironmentCapable 오류  (0) 2023.04.02
redirect / forward  (0) 2023.02.26
Property와 Constructor  (0) 2023.02.26

구현하고자 하는 코드 만들기전 그렸던 그림

class Solution {
    static int answer = 0;
    public int solution(int[] numbers, int target) {
        DFS(0, target, 0, numbers);
        return answer;
    }
    
	public void DFS(int row, int target, int sum, int[]numbers) {
		 
		if(row==numbers.length) {
    		if(sum==target) {
    			answer++;
    		}
    		return;
    	}else{
    		DFS(row+1,target,sum+numbers[row],numbers);
		    DFS(row+1,target,sum-numbers[row],numbers);
	        }
	}
}

'프로그래머스 코딩테스트' 카테고리의 다른 글

게임 맵 최단거리  (0) 2023.02.27
위장  (0) 2023.02.24
전화번호 목록  (0) 2023.02.23
완주하지 못한 선수  (0) 2023.02.23
폰켓몬  (0) 2023.02.23

+ Recent posts