목록PROGRAMMING (318)
MY MEMO
#define _CRT_SECURE_NO_WARNINGS #include using namespace std; //그냥 똑같이 자를 수 있는 개수를 구하면 됨 int main() { int m, n; scanf("%d %d", &m, &n); printf("%d", (m - 1) + m*(n - 1)); return 0; }
#define _CRT_SECURE_NO_WARNINGS #include #include using namespace std; int main() { vectorcache(2, 0); long long num; cin>>num; cache[0] = 0; cache[1] = 1; long long temp0, temp1; for (int j = 1; j < num; j++) { temp0 = cache[0] + cache[1]; temp1 = cache[0]; cache[0] = temp0; cache[1] = temp1; } cout
#define _CRT_SECURE_NO_WARNINGS #include #include #define max(a,b) ((a) > (b) ? (a) : (b)) #define min(a,b) ((a) < (b) ? (a) : (b)) using namespace std; //전역변수가 메모리 범위가 더 큼 int Maxcache[100001][3], Mincache[100001][3],tower[3]; int main() { int arr_count; scanf("%d", &arr_count); int Max = 0,Min=0; for (int j = 1; j
#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #define MAX 99999999 using namespace std; int main() { int n, num; scanf("%d", &n); vectorDP(100001, MAX); for (int j = 1; j
#define _CRT_SECURE_NO_WARNINGS #include #include #include #define MAX 99999999 using namespace std; vector cache; int main() { int num; scanf("%d", &num); cache = vector(num + 1,0); for (int j = 2; j
#define _CRT_SECURE_NO_WARNINGS #include #include using namespace std; int main() { int house; scanf("%d", &house); int R, G, B, inputR, inputG, inputB, tempR, tempG, tempB; scanf("%d %d %d", &R, &G, &B); for (int j = 0; j < house - 1; j++) { scanf("%d %d %d", &inputR, &inputG, &inputB); tempR = inputR + min(G, B); tempG = inputG + min(R, B); tempB = inputB + min(R, G); R = tempR, G = tempG, B =..
#define _CRT_SECURE_NO_WARNINGS #include #include using namespace std; vector memorization; int calculate(int n, int k) { if (k == 1) return n; if (n == k) return 1; int &ret = memorization[n][k]; if (ret != -1) return ret; return ret = calculate(n - 1, k - 1) + calculate(n - 1, k); } int main() { int for_count; scanf("%d", &for_count); memorization = vector(31, vector(31, -1)); for (int i = 0; ..
#define _CRT_SECURE_NO_WARNINGS #include #include using namespace std; int zero_count, one_count; int fibo(int n) { if (n == 1) { one_count++; return 1; } if (n == 0) { zero_count++; return 0; } return fibo(n - 1) + fibo(n - 2); } int main() { int for_count,n; scanf("%d", &for_count); for (int j = 0; j < for_count; j++) { scanf("%d", &n); zero_count = 0; one_count = 0; fibo(n); printf("%d %d\n",..
#include #include #include using namespace std; vector map = vector(12,0); int fibo(int n) { if (n == 1) return 1; if (n == 2) return 2; if (n == 3) return 4; return fibo(n - 1) + fibo(n - 2) + fibo(n - 3); } int main() { cout
자리수 0으로시작 1로시작 2로시작 3으로시작 4로시작 5로시작 6으로시작 7로시작 8로시작 9로시작 합 출력 1 1 1 1 1 1 1 1 1 1 1 10 10 2 10 9 8 7 6 5 4 3 2 1 55 55 3 55 45 36 28 21 15 10 6 3 1 220 220 4 220 165 120 84 56 35 20 10 4 1 715 715 5 715 495 330 210 126 70 35 15 5 1 2002 2002 6 2002 1287 792 462 252 126 56 21 6 1 5005 5005 7 5005 3003 1716 924 462 210 84 28 7 1 11440 1433 8 11440 6435 3432 1716 792 330 120 36 8 1 24310 4296 9 243..