목록Algorithm/C++ (148)
cgy12306
#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); // N 여자, M 남자, K 인턴 int N, M, K, team = 0; cin >> N >> M >> K; while (N > 1 && M > 0 && N+M-K>2) { N -= 2; M--; team++; } cout
#pragma warning(disable:4996) #include int main() { int a = 0, b = 1, c, n, i=0, sum=0; scanf("%d", &n); if (n == 0) { printf("0"); return 0; } else if (n == 1) { printf("1"); return 0; } for (i = 1; i < n; i++) { c = a + b; a = b; b = c; } printf("%d", c); return 0; }
// https://www.acmicpc.net/problem/11727 // 2xn 타일링 2 #include using namespace std; int dp[1001]; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; dp[1] = 1; dp[2] = 3; for (int i = 3; i
#include using namespace std; int dp[1001]; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; dp[1] = 1; dp[2] = 2; for (int i = 3; i
#include #include #include using namespace std; int DP[1000001] = { 0, }; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int X, a, b, c; cin >> X; DP[1] = 0; DP[2] = 1; DP[3] = 1; for (int i = 4; i
#include #include #include using namespace std; int arr[1001][1001] = { 0, }; int visit[1001]; int n, m; queue q; void dfs(int v) { cout v; for (int i = 0; i > x >> y; arr[x][y] = 1; arr[y][x] = 1; } dfs(v); cout
#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, DP[12] ,T; cin >> n; DP[1] = 1; DP[2] = 2; DP[3] = 4; for (int i = 0; i > T; for (int j = 4; j
#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int E, S, M, year = 1; cin >> E >> S >> M; while (!(E == 1 && S == 1 && M == 1)) { E--; S--; M--; if (E == 0) E = 15; if (S == 0) S = 28; if (M == 0) M = 19; year++; } cout