Algorithm
-
금강석 - 2496Algorithm/BOJ 2020. 3. 19. 15:06
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 //2496 - 금강석 #include #include using namespace std; int N, M, T, K; int X[100], Y[100]; int convertX(int x, int y) { return x - y; } int convertY(int x, int y) { return x + y; } void init(..
-
보석 - 2492Algorithm/BOJ 2020. 3. 19. 05:48
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 //2492 - 보석 #include using namespace std; int N, M, T, K; int X[100]; int Y[100]; void init() { cin >> N >> M >> T >> K; for(int i = 0; i> X[i] >> Y[i]; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); init(); int ansX, ansY, ans = 0; int ..
-
게임 - 1103Algorithm/BOJ 2020. 3. 16. 05:00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 //1103 - 게임 #include #include using namespace std; #define INF 2000000000 int N, M; int arr[50][50]; //북 동 남 서 int cache[50][50][4]; int xarr[4] = {-1, 0, 1, 0}; int yarr[4] = {0, 1, 0, -1}; void init() { cin ..
-
PLAYERJINAH’S BOTTLEGROUNDS - 15803Algorithm/BOJ 2020. 3. 16. 03:03
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 //15803 - PLAYERJINAH’S BOTTLEGROUNDS #include using namespace std; double x[3]; double y[3]; int main() { for(int i = 0; i> x[i] >> y[i]; int flag = true; if(x[0] == x[1] && x[1] == x[2]) flag = false; else if(y[0] == y[1] && y[1] == y[2]) flag = false; else if((double){(x[0]-x[1])/(y[0]-y[1])} == (double){(x[1]-x[2])/(y[1]-y[2])}) ..
-
트리 나라 관광 가이드 - 15805Algorithm/BOJ 2020. 3. 16. 03:01
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 //15805 - 트리 나라 관광 가이드 #include using namespace std; int N; int arr[200000], parent[200000]; bool visit[200000]; int main() { cin >> N; for(int i = 0; i> arr[i], visit[i] = false; int ans = 0; int child = -1; for(int i = 0; i
-
저거 못 타면 지각이야!! - 15804Algorithm/BOJ 2020. 3. 16. 02:57
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 //15804 - 저거 못 타면 지각이야!! #include #include using namespace std; int N, K; int arr[100]; int wait[100]; void init() { cin >> N >> K; for(int i = 0; i> arr[i] >> wait[i]; } int main() { init(); int time = 1; int idx = 0; in..
-
주말 여행 계획 - 15808Algorithm/BOJ 2020. 3. 16. 02:54
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 //15808 - 주말 여행 계획 #include #include #include using namespace std; #define INF 1000000000 int N; vector adj; void init() { cin >> N; adj = vector(N+2); int c; for(int i = 1; i c; if(..