Coding Test (163) 썸네일형 리스트형 백준 14400 편의점 2 https://www.acmicpc.net/problem/14400#include #include #include #include using namespace std;vector X;vector Y;int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; long long ans = 0; cin >> n; X.resize(n); Y.resize(n); for (int i = 0; i > X[i] >> Y[i]; } sort(X.begin(), X.end()); sort(Y.begin(), Y.end()); int ansX = X[(n - 1) / 2.. 백준 14247 나무 자르기 https://www.acmicpc.net/problem/14247#include #include #include using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, ans = 0; vector> tree; cin >> n; tree.resize(n); for (int i = 0; i > tree[i].second; } for (int i = 0; i > tree[i].first; } sort(tree.begin(), tree.end()); for (int i = 0; i 1. 문제나무 n개의 초기 .. 백준 1946 신입 사원 https://www.acmicpc.net/problem/1946#include #include #include using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; for (int test = 0; test > arr; cin >> n; arr.resize(n); for (int i = 0; i > arr[i].first >> arr[i].second; } sort(arr.begin(), arr.end()); int temp = 0; int a.. 백준 1092 배 https://www.acmicpc.net/problem/1092#include #include #include using namespace std;vector lim;vector box;int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m; int ans = 0; cin >> n; lim.resize(n); for (int i = 0; i > lim[i]; } sort(lim.begin(), lim.end(), greater()); cin >> m; box.resize(m); for (int i = 0; i > box[i]; } s.. 백준 2212 센서 https://www.acmicpc.net/problem/2212#include #include #include using namespace std;vector arr;vector dif;int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, k; int ans = 0; cin >> n >> k; arr.resize(n); dif.resize(n - 1); for (int i = 0; i > arr[i]; } sort(arr.begin(), arr.end()); for (int i = 0; i 1. 문제n개의 센서의 x좌표상의 위치와 집중국의 개수 k가.. 백준 19598 최소 회의실 개수 https://www.acmicpc.net/problem/19598 #include #include #include #define INF 987654321using namespace std;priority_queue, vector>, greater>> pq;priority_queue, greater> res;int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; for (int i = 0; i > s >> e; pq.push(make_pair(s, e)); } res.push(pq.top().second); pq.pop(); while.. 백준 5904 Moo 게임 https://www.acmicpc.net/problem/5904#include using namespace std;string st = "moo";void s(int n, int k, int len) { int nLen = len * 2 + k + 3; if (n len && n > N; s(N, 1, 3); return 0;}1. 문제길이가 무한대인 Moo 수열이 있다. 이는 다음과 같은 규칙을 따른다.s(0)=moos(k)=s(k-1)+moo...o(o가 k-2개)+s(k-1)n이 주어졌을 때, n번째 글자를 구하라.2. 풀이규칙 자체가 재귀적이므로 이를 사용하여 구현할 수 있다. 우선 해당 수열은 다음과 같이 주어져있다. 중간의 moo...o의 길이는 k-1이므로 s(k-1.. 백준 10775 공항 https://www.acmicpc.net/problem/10775#include #include using namespace std;int parent[100001];//i번 비행기는 1번 게이트부터 fly[i]번 게이트 중 하나에 영구적으로 도킹int fly[100001];int findParent(int k){ return parent[k] == k ? k : parent[k]=findParent(parent[k]);}void uni(int a, int b){ int pa = findParent(a); int pb = findParent(b); if (pa != pb) { parent[pa] = pb; }}int main() { ios::sync_with.. 이전 1 ··· 9 10 11 12 13 14 15 ··· 21 다음