목록PROGRAMMING (318)
MY MEMO
틀린 코드...#define _CRT_SECURE_NO_WARNINGS #include #include #include using namespace std; int main() { int a, b, input; scanf("%d %d", &a, &b); setA; for (int j = 0; j < a; j++) { scanf("%d", &input); A.insert(input); } set::iterator iter; int B, count = 0; for (int j = 0; j < b; j++) { scanf("%d", &B); iter = A.lower_bound(B); if (iter != A.end()) { count++; A.erase(iter); for (iter = A.begin(); ..
#define _CRT_SECURE_NO_WARNINGS #include #include #include using namespace std; int main() { int n, quiz_count; scanf("%d %d", &n, &quiz_count); vectornum(n+1); for (int j = 1; j = start && num[j].second
#define _CRT_SECURE_NO_WARNINGS #include #include #include using namespace std; int main() { int n,input; scanf("%d", &n); vectorDP(n); for (int j = 0; j < n; j++) scanf("%d", &DP[j]); if (prev_permutation(DP.begin(), DP.end())) for (int j = 0; j < n; j++)printf("%d ", DP[j]); else printf("-1"); return 0; }
#define _CRT_SECURE_NO_WARNINGS #include #include #include using namespace std; int main() { int n; scanf("%d", &n); vectorDP; for (int j = 1; j
#define _CRT_SECURE_NO_WARNINGS #include #include #include using namespace std; int main() { vectormap(1001, vector(1001)); int row, col; scanf("%d %d", &row, &col); for (int x = 0; x < row; x++) for (int y = 0; y < col; y++) scanf("%d", &map[x][y]); vectorDP(2, vector(1001, 0));; for (int y = 0; y < col - 1; y++) map[0][y + 1] += map[0][y]; for (int x = 1; x < row; x++) { DP[0][0] = map[x][0] +..
#define _CRT_SECURE_NO_WARNINGS #include #include #include using namespace std; int main() { int volSize, startVol, maxVol; scanf("%d %d %d", &volSize, &startVol, &maxVol); vectorDP(1001, vector(1001, -1)); vectorvol(101); for (int j = 0; j < volSize; j++) scanf("%d", &vol[j]); DP[0][startVol] = 1; for (int j = 1; j
#define _CRT_SECURE_NO_WARNINGS #include #include #include #define MAX 2e9 using namespace std; int main() { int n; vectormap(1001), DP(1001, MAX); scanf("%d", &n); for (int x = 0; x = 0; x--) { for (int jump = 1; jump
#define _CRT_SECURE_NO_WARNINGS #include #include #include using namespace std; int main() { int for_count; scanf("%d", &for_count); while (for_count--) { int n,money; scanf("%d", &n); vectorDP(10001, 0), coin(10001); for (int j = 0; j < n; j++) scanf("%d", &coin[j]); scanf("%d", &money); for (int j = 0; j < n; j++) { DP[coin[j]]++; for (int k = 1; coin[j] + k
#define _CRT_SECURE_NO_WARNINGS #include #include using namespace std; int main() { int n, m; scanf("%d %d", &n, &m); vectormap(1000001); for (int x = 0; x < n; x++) { scanf("%d", &map[x]); map[x] %= m; } vectorcnt(1001,0); int sum = 0; cnt[0] = 1; for (int x = 0; x < n; x++) { sum += map[x]; sum %= m; cnt[sum] += 1; } long long answer = 0; for (int x = 0; x < m; x++) answer += (cnt[x] * (cnt[x]..
#define _CRT_SECURE_NO_WARNINGS #include #include #include using namespace std; int main() { int n; scanf("%d", &n); vector map(n, vector(n)); for (int x = 0; x < n; x++) for (int y = 0; y < n; y++) scanf("%d", &map[x][y]); vectorDP(n); for (int x = 0; x < n; x++) DP[x] = x; int answer = 2e9; do { bool ok = true; int sum = 0; for (int x = 0; x < n - 1; x++) { if (map[DP[x]][DP[x + 1]]) sum += ma..