목록전체 글 (94)
혼자 정리
문제링크 C++ #include using namespace std; typedef unsigned int uint; uint g[5]; uint K; uint g_rot[5]; void rotate_to_left(uint loc, uint rot){ if (loc - 1 > 0){ if (((g[loc - 1] & 0b00100000) != 0) != ((g[loc] & 0b00000010) != 0)){ g_rot[loc - 1] = rot * (-1); rotate_to_left(loc - 1, rot * (-1)); } } } void rotate_to_right(uint loc, uint rot){ if (loc + 1 = 1; g[i] |= 0b10000000; }else{ g[i] >>= 1..
문제링크 C++ #include using namespace std; int N, L; int map[100][100]; int ret; int main(){ ios::sync_with_stdio(0); cin.tie(0); cin >> N >> L; for (int i = 0; i > map[i][j]; } } for (int i = 0; i < N; i++){ int succ = 0; int before = map[i][0]; int able_to_put_slope = 0; int is_a_path = 1; for (int j = 0; j < N; j++){ if (map[i][j] == before) succ++; el..
문제링크 C++ #include #include using namespace std; #define APPLE -1 #define DOWN 2 #define LEFT 3 #define UP 4 #define RIGHT 5 int N, K; int apple_pos[100][2]; int L; int board[101][101]; int move_int[100]; char move_char[100]; pair head_pos; pair tail_pos; queue q; int elapsed_sec; int direction = RIGHT; void game(){ while (1){ elapsed_sec++; if (direction == RIGHT){ head_pos.second++; }else if (d..
문제링크 C++ 1st try #include #include using namespace std; int N, S[20][20]; int ret_min = 1000000000; int check_board[20]; void solve(){ int ptr_start = 0, ptr_link = 0; vector member_start, member_link; for (int i = 0; i < N; i++){ if (check_board[i] == 1){ member_start.push_back(i); }else{ member_link.push_back(i); } } for (auto i : member_start){ for (auto j : member_start){ if (i != j){ ptr_st..
문제링크 C++ #include using namespace std; int N; int A[11]; int oper[4]; int min_ret = 1000000000; int max_ret = -1000000000; void fun(int idx, int ret, int add, int sub, int mult, int div){ if (idx == N){ if (ret max_ret) max_ret = ret; return ; } if (add > 0) fun(idx + 1, ret + A[idx], add - 1, sub, mult, div); if (sub > 0) fun(idx + 1, ret - A[idx], add, sub -..
문제링크 C++ #include #include #include #include using namespace std; int N, M; int my_map[8][8]; int ret; int num_empty; int to_subtract; queue Q; vector emptypos; int di[4] = {0, 0, -1, 1}; int dj[4] = {1, -1, 0, 0}; int visited[8][8]; void find2(){ queue q = Q; memset(visited, 0, sizeof(visited)); while (!q.empty()){ pair tmp = q.front(); q.pop(); int i, j; for (int idx = 0; idx < 4; idx++){ i = ..
문제링크 C++ #include using namespace std; int N, M; int map[500][500]; int ret; int main(){ ios::sync_with_stdio(0); cin.tie(0); cin >> N >> M; for (int i = 0; i > map[i][j]; } } int tmp; for (int i = 0; i ret) { ret = t..
C++ 1st try #include #include using namespace std; int N, B, C; vector A; long long ret; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> N; for (int i = 0; i > tmp; A.push_back(tmp); } cin >> B >> C; for (int i = 0; i >..
문제링크 C++ 처음 작성 #include using namespace std; int N, M, x, y, K; int map[20][20]; int dice[7]; void go_east() { if (y + 1 >= M) return ; y += 1; int tmp; tmp = dice[4]; dice[4] = dice[6]; dice[6] = dice[3]; dice[3] = dice[1]; dice[1] = tmp; if (map[x][y] == 0) { map[x][y] = dice[6]; } else { dice[6] = map[x][y]; map[x][y] = 0; } cout > K; for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) ..