전체 글67 프로그래머스 - 행렬 테두리 회전하기 #include #include #include using namespace std; vector board; int c; int dx[] = {1,0,-1,0}; int dy[] = {0,1,0,-1}; int r(vector q) { int dir = 0; int sy = q[0] - 1; int sx = q[1] - 1; int ey = q[2] - 1; int ex = q[3] - 1; int cy = sy + dy[dir]; int cx = sx + dx[dir]; int t = board[sy][sx]; int ans = c; while (1) { ans = min(ans, t); swap(t, board[cy][cx]); if (cy == sy && cx == sx) { break; } if.. 2021. 10. 9. 2019 KAKAO BLIND RECRUITMENT / 길 찾기 게임 2019 KAKAO BLIND RECRUITMENT 길 찾기 게임 #include #include #include using namespace std; class Node { public: int n; Node* l; Node* r; int x; int y; }; void make(Node* r, Node* n) { if (n->x x) { if (!r->l) { r->l = n; return; } make(r->l, n); return; } if (!r->r) { r->r = n; return; } make(r->r, n); } void dfs(Node* r, vector &v) { if (!r) return; v.push_back(r->n + 1); dfs(r->l, v); dfs(r->r,.. 2021. 9. 19. Softeer - 사물인식 최소 면적 산출 프로그램 https://softeer.ai/practice/info.do?eventIdx=1&psProblemId=531&sw_prbl_sbms_sn=16060 #include #include #include #include #include #include #include using namespace std; int N; int K; int ans; struct Coord { int x; int y; int k; }; struct Rect { int l; int r; int t; int b; }; int min(int a, int b) { return a > b ? b : a; } int max(int a, int b) { return a > b ? a : b; } int area(int x1, int y1, i.. 2021. 8. 30. Softeer - 수퍼바이러스 https://softeer.ai/practice/info.do?eventIdx=1&psProblemId=391&sw_prbl_sbms_sn=14494 #include #include #include #include #include using namespace std; int main() { const int MOD = 1000000007; long long N, P, T; cin >> N >> P >> T; T *= 10; P %= MOD; long long ans = N; while (T) { long long p = P; long long count = 1; while (T > 2 * count) { p *= p; p %= MOD; count *= 2; } T -= count; ans *= p; a.. 2021. 8. 20. 이전 1 ··· 10 11 12 13 14 15 16 17 다음