-
Notifications
You must be signed in to change notification settings - Fork 4
[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
Merged
[21주차] 이지영 #294
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
BOJ/1000-5000번/JY_2170.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.