Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[21주차] 이지영 #294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
KodaHye merged 3 commits into GreatAlgorithm-Study:main from yeongleej:main
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions BOJ/1000-5000번/JY_2170.java
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import java.io.*;
import java.util.*;
public class JY_2170 {

static class Pos implements Comparable<Pos> {
int x, y;

public Pos(int x, int y) {
super();
this.x = x;
this.y = y;
}
@Override
public int compareTo(Pos other) {
return this.x - other.x;
}

@Override
public String toString() {
return "Pos [x=" + x + ", y=" + y + "]";
}

}

public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());

int N = Integer.parseInt(st.nextToken());

List<Pos> pList = new ArrayList<>();
for(int i=0; i<N; i++) {
st = new StringTokenizer(br.readLine());
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());

pList.add(new Pos(x, y));
}

// x기준으로 정렬
Collections.sort(pList);

int s = pList.get(0).x;
int e = pList.get(0).y;
int ans = 0;
for(int i=1; i<N; i++) {
Pos now = pList.get(i);

// now.x가 end보다 작다면 겹침 -> end 갱신
if(e >= now.x) {
e = Math.max(e, now.y);
}
// 겹치지 않는 경우
else {
// 기존것 더해주고 새로 업데이트
ans += (e - s);
s = now.x;
e = now.y;
}
}
ans += (e - s);
System.out.println(ans);

}

}
51 changes: 51 additions & 0 deletions BOJ/1000-5000번/JY_2504.java
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import java.io.*;
import java.util.*;
public class JY_2504 {

public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

String line = br.readLine();

Stack<Character> stack = new Stack<>();

int ans = 0;
int tmp = 1;
for(int i=0; i<line.length(); i++) {
char ch = line.charAt(i);
// 열린괄호
if(ch == '(') {
stack.push(ch);
tmp *= 2;
} else if(ch == '[') {
stack.push(ch);
tmp *= 3;
}
// 닫힌 괄호
else {
if(stack.isEmpty()) {
ans = 0;
break;
}
// 올바르지 않은 괄호
if((ch == ')' && stack.peek() == '[') || (ch == ']' && stack.peek() =='(')) {
ans = 0;
break;
}
// 이전 값이 올바른 괄호라면 값 저장
if(ch == ')') {
if(line.charAt(i-1)=='(') ans += tmp;
tmp /= 2;
} else {
if(line.charAt(i-1)=='[') ans += tmp;
tmp /= 3;
}
stack.pop();
}
}

if(!stack.isEmpty()) System.out.println(0);
else System.out.println(ans);
}

}
8 changes: 8 additions & 0 deletions SQL/21주차/JY_FrontEnd_개발자_찾기.sql
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- https://school.programmers.co.kr/learn/courses/30/lessons/276035
-- FrontEnd 개발자 찾기
SELECT DISTINCT A.ID, A.EMAIL, A.FIRST_NAME, A.LAST_NAME
FROM DEVELOPERS A
JOIN SKILLCODES B
ON A.SKILL_CODE & B.CODE = B.CODE
WHERE CATEGORY = "Front End"
ORDER BY A.ID

AltStyle によって変換されたページ (->オリジナル) /