diff --git "a/BOJ/1000-5000353円262円210円/JY_2170.java" "b/BOJ/1000-5000353円262円210円/JY_2170.java" new file mode 100644 index 00000000..c6cc4d10 --- /dev/null +++ "b/BOJ/1000-5000353円262円210円/JY_2170.java" @@ -0,0 +1,66 @@ +import java.io.*; +import java.util.*; +public class JY_2170 { + + static class Pos implements Comparable { + 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 pList = new ArrayList(); + for(int i=0; i 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); + + } + +} diff --git "a/BOJ/1000-5000353円262円210円/JY_2504.java" "b/BOJ/1000-5000353円262円210円/JY_2504.java" new file mode 100644 index 00000000..7faad233 --- /dev/null +++ "b/BOJ/1000-5000353円262円210円/JY_2504.java" @@ -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 stack = new Stack(); + + int ans = 0; + int tmp = 1; + for(int i=0; i

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