MY MEMO
#define _CRT_SECURE_NO_WARNINGS #include #include using namespace std; int n; vectordp(1001, vector(3, vector(4,-1))); /* 지각 2번 || 결석 3번 연속이면 안됨 */ int Check_Attendance(int attendCnt, int lateCnt, int absentCnt) { if (absentCnt >= 3 || lateCnt >= 2) return 0; if (attendCnt == n) return 1; int&ret = dp[attendCnt][lateCnt][absentCnt]; if (ret != -1) return ret; return ret = (Check_Attendance(atten..
#include #include #include using namespace std; int main() { int n; int t=1; cin >> n; while (n != 0) { vector graph(n, vector(3, 0)); vector d(n, vector(3, 0)); for (int i = 0; i > graph[i][j]; } } d[0][1] = graph[0][1]; d[0][2] = d[0][1] + graph[0][2]; for (int i = 1; i < n; i++) { for (int j = 0; j < 3; j++) { if (j == 0) { d[i][j] = graph[i][j] ..
#define _CRT_SECURE_NO_WARNINGS #include #include #include using namespace std; int main() { int n; long long Max, num; scanf("%d", &n); while (n--) { scanf("%lld", &num); Max = num; while (num!=1) { Max = max(Max, num); if (num % 2 == 0) num /= 2; else num = num * 3 + 1; } printf("%lld\n", Max); } return 0; } 이 문제를 풀면서 얻은 교훈 : scanf와 printf를 사용하자..시간초과로..고생했다..