본문 바로가기

알고리즘16

DFS, BFS import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.LinkedList; import java.util.Queue; import java.util.Stack; import java.util.StringTokenizer; public class Mai.. 2018. 7. 17.
컨벡스 헐 (Convex hull) import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Stack; import java.util.StringTokenizer; class Edge { int x; int y; Edge (int x, int y){ this.x = x; th.. 2018. 7. 17.
이분탐색 (Binary Search) import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Main { /* * https://www.acmicpc.net/problem/1920 */ public static void main(String[] args) throws.. 2018. 7. 17.
CCW 총 세점에서 두 점과 나머지 한점의 위치를 판단함삼각형 면적 구하는 공식(다각형 면적 구하는 공식, N각형) static int ccw(Point a, Point b, Point c) { long result = (a.x*b.y+b.x*c.y+c.x*a.y) - (b.x*a.y+c.x*b.y+a.x*c.y); if (result > 0) return 1; if (result < 0) return -1; return 0; } 2017. 12. 12.