목록공부한거/백준알고리즘 (9)
눈팅하는 게임개발자 블로그
#include #include using namespace std; #define SWAP(x,y,z) z = x, x = y, y = z; int line[1001][1001]; int visited[1001]; class queq { private: int arr[1000]; int *_front; int *_back; int size; void bubble_swap() { int temp = -1; for (int i = 0; i < size; i++) { SWAP(arr[i], arr[i + 1], temp); } } void renew() { if (size == 0) { _front = nullptr; _back = nullptr; } else { _back = arr + size - 1; ..
#include using namespace std; #define SWAP(x,y,z) z = x, x = y, y = z; class documentary { private: int priority; bool target; public: documentary() { priority = 0; target = false; } documentary(int p, bool t) { priority = p; target = t; } void set_priority(int p) { priority = p; } int get_priority() { return priority; } void set_target(bool t) { target = t; } bool get_target() { return target; ..
#include #include #include using namespace std; bool arr[10001]; int minone(vector v,int n) { vector v1; int temp; for (int i = 0; i v1[i]) { mi = v1[i]; ind = i; } } return v[ind]; } int main() { memset(arr, 1, sizeof(arr)); vecto..
#include #include #include #include #include using namespace std; int frequent(int b[], int N) { int max = 0; vector v; for (int i = 4000; i >= 0; i--) { if (max < b[i]) { max = b[i]; v.clear(); v.push_back(i*(-1)); } else if (max == b[i]) { v.push_back(i*(-1)); } } for (int i = 4001; i < 8001; i++) { if (max < b[i]) { max = b[i]; v.clear(); v.push_back(i - 4000); } else if (max == b[i]) { v.pus..
#include #include using namespace std; int main() { int N; cin >> N; int count[10001]; memset(&count[0], 0, 10001*4); int num; for (int i = 0; i > num; count[num]++; } for (int i = 0; i < 10001; i++) { for (int j = 0; j < count[i]; j++) { cout
#include using namespace std; int calc(int M, int N, int x, int y); int main() { int cnt = -1; int cnt_temp = 0; int T; cin >> T; int M, N, x, y; for (int i = 0; i > M >> N >> x >> y; cout
#include #include using namespace std; int memoization[15][15]; void init() { for (int i = 0; i T; int k, n; for (int i = 0; i > k >> n; cout
#include #include using namespace std; int arr[26]; void init() { memset(&arr[0], 0, 26 * 4); } int main() { char a = 'a'; int n, sum=0; cin >> n; char str[100][100]; for (int i = 0; i
#include #include using namespace std; char is_star[1024 * 3][1024 * 6]; void init(int n) { for (int i = 0; i < n; i++) { memset(&is_star[i][0],' ', (2 * n)); } } int squaring(int n) { int a = 1; for (int i = 0; i < n; i++) { a = a * 3; } return a; } void star_tree(int p1, int p2) { is_star[p1][p2] = '*'; // 0 , 2 is_star[p1 + 1][p2 - 1] = '*'; is_star[p1 + 1][p2 + 1] = '*'; for (int i = 0; i < ..