전체 글 (224) 썸네일형 리스트형 백준 1806 부분합 (C++) https://www.acmicpc.net/problem/1806#include #include #define INF 987654321using namespace std;vector arr;vector prefix;int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, S; int ans = INF; cin >> n >> S; arr.resize(n); prefix.resize(n); for (int i = 0; i > arr[i]; if (!i) { prefix[i] = arr[i]; } else { pr.. 백준 20924 트리의 기둥과 기지 (C++) https://www.acmicpc.net/problem/20924#include #include #include using namespace std;//g[i][n]={dist, j}vector> g[200001];bool visit[200001];int maxTrunk = 0;int maxBranch = 0;int giga;void dfs_trunk(int cur, int len){ visit[cur] = true; maxTrunk = max(maxTrunk, len); giga = cur; if (g[cur].size() > 2) { return; } for(int i=0;i> n >> r; for (int i = 0; i > a >> b >> d;.. 백준 2056 작업 (C++) https://www.acmicpc.net/problem/2056#include #include #include #include using namespace std;vector g[10001];vector t;vector indeg;vector res;int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; int ans = -1; cin >> n; t.resize(n + 1); indeg.resize(n + 1, 0); for (int i = 1; i > t[i]; int inCnt; cin >> inCnt; for (int j = .. 백준 3107 IPv6 (C++) https://www.acmicpc.net/problem/3107#include #include using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); string s; cin >> s; string ans; string temp; int cnt = 0; for (int i = 0; i 1. 문제축약된 IPv6의 주소가 주어진다. 이는 다음의 규칙으로 만들어진 주소이다.각 그룹의 앞자리의 0의 전체 또는 일부를 생략할 수 있다.만약 0으로만 이루어져 있는 그룹이 있을 경우 그 중 한 개 이상 연속된 그룹을 하나 골라 콜론 두개로 바꿀 수 있다. .. 백준 16236 아기 상어 (C++) https://www.acmicpc.net/problem/16236#include #include #include using namespace std;vector> arr;bool visit[21][21];int dy[4] = {-1, 0, 0, 1};int dx[4] = {0, -1, 1, 0};int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; int ans = 0; cin >> n; arr.resize(n, vector(n)); pair eat; for (int i = 0; i > arr[i][j]; if (arr[i][j] == 9) { .. 백준 1956 운동 (C++) https://www.acmicpc.net/problem/1956#include #include #define INF 987654321using namespace std;int dist[401][401];int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int v, e; int ans = INF; cin >> v >> e; fill_n(*dist, 401 * 401, INF); for (int i = 0; i > start >> end >> di; dist[start][end] = di; } for (int k = 1; k 1. 문제방향성 그래프의 vertex.. 백준 1749 점수따먹기 (C++) https://www.acmicpc.net/problem/1749#include #include using namespace std;vector> arr;vector> prefix;int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m; int ans = -987654321; cin >> n >> m; arr.resize(n + 1, vector(m + 1)); prefix.resize(n + 1, vector(m + 1)); for (int i = 1; i > arr[i][j]; } } for (int i = 1; i 1. 문제n*m의 행렬이.. 백준 1368 물대기 (C++) https://www.acmicpc.net/problem/1368#include #include #include using namespace std;vector sCost;vector> cCost;int parent[301];int findP(int k) { if (parent[k] == k) { return k; } else { return parent[k] = findP(parent[k]); }}void uni(int a, int b){ int pA = findP(a); int pB = findP(b); if (pA == pB) { return; } if (pA > pB) { parent[pA] = pB; .. 이전 1 ··· 11 12 13 14 15 16 17 ··· 28 다음