From d632d74ddd2336893be77d0430afe1f8f111f6ec Mon Sep 17 00:00:00 2001 From: IsuminI <149383661+IsuminI@users.noreply.github.com> Date: Wed, 10 Jul 2024 01:01:04 +0900 Subject: [PATCH 1/5] 17386 --- .../17386.c" | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 "\354\235\264\354\210\230\353\257\274/17386.c" diff --git "a/\354\235\264\354\210\230\353\257\274/17386.c" "b/\354\235\264\354\210\230\353\257\274/17386.c" new file mode 100644 index 00000000..28b6b065 --- /dev/null +++ "b/\354\235\264\354\210\230\353\257\274/17386.c" @@ -0,0 +1,29 @@ +#include +#include +typedef struct { + long long int x,y; +}st; +int ccw(st p1, st p2, st p3) { + long long int s = (p1.x*p2.y + p2.x*p3.y + p3.x*p1.y) - (p1.x*p3.y + p2.x*p1.y + p3.x*p2.y); + if(s > 0) return 1; + else if(s == 0) return 0; + return -1; +} +int isCross(st p1, st p2, st p3, st p4) { + int p1p2 = ccw(p1, p2, p3) * ccw(p1, p2, p4); + int p3p4 = ccw(p3, p4, p1) * ccw(p3, p4, p2); + return p1p2 <= 0 && p3p4 <= 0; +} +int main() +{ + int x1,x2,x3,x4,y1,y2,y3,y4; + scanf("%d %d %d %d",&x1,&y1,&x2,&y2); + scanf("%d %d %d %d",&x3,&y3,&x4,&y4); + st p1 = {x1, y1}; + st p2 = {x2, y2}; + st p3 = {x3, y3}; + st p4 = {x4, y4}; + + printf("%d",isCross(p1, p2, p3, p4)); + return 0; +} From e68b1ed0105eeb408025730e56b9a97f34c9474f Mon Sep 17 00:00:00 2001 From: RangKoon <162738215+RangKoon@users.noreply.github.com> Date: Wed, 10 Jul 2024 15:24:55 +0900 Subject: [PATCH 2/5] Create S4_2164 --- .../S4_2164" | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 "\354\247\204\353\257\274\355\230\201/S4_2164" diff --git "a/\354\247\204\353\257\274\355\230\201/S4_2164" "b/\354\247\204\353\257\274\355\230\201/S4_2164" new file mode 100644 index 00000000..579ba8f5 --- /dev/null +++ "b/\354\247\204\353\257\274\355\230\201/S4_2164" @@ -0,0 +1,20 @@ +import java.util.*; +import java.io.*; + +public class Main { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + + int n = Integer.parseInt(br.readLine()); + Queue q = new LinkedList<>(); + for(int i=1; i<=n; i++) { + q.add(i); + } + while(q.size() != 1) { + q.poll(); + int tmp = q.poll(); + q.add(tmp); + } + System.out.println(q.peek()); + } +} From c5457bee706541f4462209f26c9357c1a4a0cd2b Mon Sep 17 00:00:00 2001 From: RangKoon <162738215+RangKoon@users.noreply.github.com> Date: Fri, 12 Jul 2024 16:38:39 +0900 Subject: [PATCH 3/5] Create S3_17413 --- .../S3_17413" | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 "\354\247\204\353\257\274\355\230\201/S3_17413" diff --git "a/\354\247\204\353\257\274\355\230\201/S3_17413" "b/\354\247\204\353\257\274\355\230\201/S3_17413" new file mode 100644 index 00000000..08b541fc --- /dev/null +++ "b/\354\247\204\353\257\274\355\230\201/S3_17413" @@ -0,0 +1,42 @@ +import java.util.*; +import java.io.*; + +public class Main { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + String s = br.readLine(); + Stack st1 = new Stack<>(); + Stack st2 = new Stack<>(); + StringBuilder sb = new StringBuilder(); + for(int i=0; i 0) + sb.append(st1.pop()); + st2.add(c); + + } + if(st2.size()==0) { + if(c == ' ') { + while(st1.size() > 0) { + sb.append(st1.pop()); + } + sb.append(c); + } + else + st1.add(c); + } + if(st2.size() > 0 && st2.peek() == '<') { //괄호 안에 있으면 그대로 출력 + sb.append(c); + } + if(c=='>') { // 닫히면 열린거 삭제하고 그대로 출력 + st2.pop(); + } + + } + while(st1.size() > 0) { + sb.append(st1.pop()); + } + System.out.println(sb); + } +} From b1455aa9734fc4c80bbc42ed7b041a48adaede9d Mon Sep 17 00:00:00 2001 From: RangKoon <162738215+RangKoon@users.noreply.github.com> Date: Wed, 17 Jul 2024 20:43:08 +0900 Subject: [PATCH 4/5] Create S5_11866 --- .../S5_11866" | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 "\354\247\204\353\257\274\355\230\201/S5_11866" diff --git "a/\354\247\204\353\257\274\355\230\201/S5_11866" "b/\354\247\204\353\257\274\355\230\201/S5_11866" new file mode 100644 index 00000000..22495789 --- /dev/null +++ "b/\354\247\204\353\257\274\355\230\201/S5_11866" @@ -0,0 +1,31 @@ +import java.util.*; +import java.io.*; + +public class Main { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + String[] input = br.readLine().split(" "); + int n = Integer.parseInt(input[0]); + int k = Integer.parseInt(input[1]); + int cnt = 0; + Queue q = new LinkedList<>(); + StringBuilder sb = new StringBuilder(); + sb.append("<"); + for(int i=1; i<=n; i++) { + q.add(i); + } + while(q.size()>1) { + int tmp = q.peek(); + q.remove(); + cnt ++; + if(cnt%k == 0) { + sb.append(tmp + ", "); + } + else { + q.add(tmp); + } + } + sb.append(q.peek() + ">"); + System.out.println(sb); + } +} From 7ea4847d99f0e450fd6af4101c0fc301c5171bee Mon Sep 17 00:00:00 2001 From: RangKoon <162738215+RangKoon@users.noreply.github.com> Date: Thu, 18 Jul 2024 13:56:38 +0900 Subject: [PATCH 5/5] Create S4_1620 --- .../S4_1620" | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 "\354\247\204\353\257\274\355\230\201/S4_1620" diff --git "a/\354\247\204\353\257\274\355\230\201/S4_1620" "b/\354\247\204\353\257\274\355\230\201/S4_1620" new file mode 100644 index 00000000..2f6e0335 --- /dev/null +++ "b/\354\247\204\353\257\274\355\230\201/S4_1620" @@ -0,0 +1,25 @@ +import java.util.*; +import java.io.*; + +public class Main { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + String[] input = br.readLine().split(" "); + int n = Integer.parseInt(input[0]); + int m = Integer.parseInt(input[1]); + HashMap map = new HashMap<>(); + + for(int i=1; i<=n; i++) { + String s1 = Integer.toString(i); + String s2 = br.readLine(); + map.put(s1, s2); + map.put(s2, s1); + } + StringBuilder sb = new StringBuilder(); + for(int i=0; i