Algorithm/BOJ
-
Scoring Hack - 17234Algorithm/BOJ 2020. 3. 20. 01:45
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 //Scoring Hack #include using namespace std; int N, A, B; bool cache[601][501][51]; void init() { cin >> N >> A >> B; cache[0][0][0] = true; } bool dp(int score, int turn, int dturn) { if(score
-
가운데를 말해요 - 1655Algorithm/BOJ 2020. 3. 19. 20:29
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 //1655 - 가운데를 말해요 #include #include using namespace std; int N; priority_queue hq, tq; void init() { hq = tq = priority_queue(); cin >> N; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); init(); int x; int ht, tt, hsize, tsize; c..
-
교환 - 1039Algorithm/BOJ 2020. 3. 19. 17:53
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 //1039 - 교환 #include using namespace std; int N, K; int length; int cache[11][1000001]; void init() { cin >> N >> K; string s = to_string(N); length = s.size(); for(int i = 0; i
-
금강석 - 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])}) ..