본문 바로가기

전공공부/코딩테스트179

(c++) 백준 "7662_우선순위_큐" https://www.acmicpc.net/problem/7662 7662번: 이중 우선순위 큐 입력 데이터는 표준입력을 사용한다. 입력은 T개의 테스트 데이터로 구성된다. 입력의 첫 번째 줄에는 입력 데이터의 수를 나타내는 정수 T가 주어진다. 각 테스트 데이터의 첫째 줄에는 Q에 적 www.acmicpc.net #include #include #include #include #include using namespace std; int main() { int T; cin >> T; for (int t = 0; t > N; map m; for (int i = 0; i > c; int num; cin >> num; if.. 2022. 8. 8.
(c++) 백준 "1697) 숨바꼭질" 숨바꼭질 https://www.acmicpc.net/problem/1697 1697번: 숨바꼭질 수빈이는 동생과 숨바꼭질을 하고 있다. 수빈이는 현재 점 N(0 ≤ N ≤ 100,000)에 있고, 동생은 점 K(0 ≤ K ≤ 100,000)에 있다. 수빈이는 걷거나 순간이동을 할 수 있다. 만약, 수빈이의 위치가 X일 www.acmicpc.net #include #include using namespace std; int N, K; int board[500000]; queue q; bool check(int now, int next) {// next N >> K; if (K 2022. 8. 5.
(c++) 백준 "1141)접두사" https://www.acmicpc.net/problem/1141 1141번: 접두사 접두사X 집합이란 집합의 어떤 한 단어가, 다른 단어의 접두어가 되지 않는 집합이다. 예를 들어, {hello}, {hello, goodbye, giant, hi}, 비어있는 집합은 모두 접두사X 집합이다. 하지만, {hello, hell}, {giant, www.acmicpc.net #include #include #include #include using namespace std; int main() { int N; cin >> N; vector list; for (int i = 0; i > tmp; list.push_back(tmp); } sort(list.beg.. 2022. 6. 27.
(c++) 백준 "1032) 명령 프롬프트" https://www.acmicpc.net/problem/1032 1032번: 명령 프롬프트 첫째 줄에 파일 이름의 개수 N이 주어진다. 둘째 줄부터 N개의 줄에는 파일 이름이 주어진다. N은 50보다 작거나 같은 자연수이고 파일 이름의 길이는 모두 같고 길이는 최대 50이다. 파일이름은 www.acmicpc.net #include #include using namespace std; int main() { int N; cin >> N; string answer; cin >> answer; for (int i = 1; i > comp; for (int k = 0; k < answer.size(); k++) { if (answer[k] != '?' &&.. 2022. 6. 27.