[C++] 백준 14단계 - 10815번 문제 (숫자 카드)
자료구조 & 알고리즘/BOJ2023. 7. 20. 23:27[C++] 백준 14단계 - 10815번 문제 (숫자 카드)

문제설명 소스코드 #include #include #include using namespace std; int main() { ios_base::sync_with_stdio(false); //표준 스트림 동기화 해제 cin.tie(nullptr); //입출력 연결 끊기 int N, M; vector vec; cin >> N; for (int i = 0; i > input; vec.push_back(input); } sort(vec.begin(), vec.end()); cin >> M; for (int i = 0; i > input; cout

[C++] 백준 13단계 - 1181번 문제 (단어 정렬)
자료구조 & 알고리즘/BOJ2023. 7. 20. 18:55[C++] 백준 13단계 - 1181번 문제 (단어 정렬)

문제설명 소스코드 #include #include using namespace std; bool compare(string a, string b) { if (a.length() != b.length()) return a.length() > N; string* arr = new string[N]; for (int i = 0; i > arr[i]; sort(arr, arr + N, compare); for (int i = 0; i < ..

[C++] 백준 13단계 - 18870번 문제 (좌표 압축)
자료구조 & 알고리즘/BOJ2023. 7. 19. 21:33[C++] 백준 13단계 - 18870번 문제 (좌표 압축)

문제설명 소스코드 #include #include #include using namespace std; int main() { ios_base::sync_with_stdio(false); //표준 스트림 동기화 해제 cin.tie(NULL); //입력과 출력 연결 끊기 vector original, tmp; int N; cin >> N; for (int i = 0; i > input; original.push_back(input); //원본 벡터에 입력받음 tmp.push_back(input); //임시 벡터에 입력받음 } sort(tmp.begin(), tmp.end()); //임시 벡터 정렬 tmp.erase(unique(tmp.begin(), tmp..

[C++] 백준 13단계 - 11651번 문제 (좌표 정렬하기 2)
자료구조 & 알고리즘/BOJ2023. 7. 19. 18:01[C++] 백준 13단계 - 11651번 문제 (좌표 정렬하기 2)

문제설명 소스코드 #include #include using namespace std; class XY { public: int x; int y; bool operator y y == arr.y) && (this->x > N; XY* arr = new XY[N]; for (int i = 0; i < N; ++i) cin ..

[C++] 백준 13단계 - 10814번 문제 (나이순 정렬)
자료구조 & 알고리즘/BOJ2023. 7. 18. 20:36[C++] 백준 13단계 - 10814번 문제 (나이순 정렬)

문제설명 소스코드 sort() 이용(quick sort) #include #include using namespace std; class name_age { public: string name; int age; int idx; bool operator age != arr.age) return this->age idx > N; name_age* arr = new name_age[N]; fo..

[C++] 백준 13단계 - 11650번 문제 (좌표 정렬하기)
자료구조 & 알고리즘/BOJ2023. 7. 18. 18:51[C++] 백준 13단계 - 11650번 문제 (좌표 정렬하기)

문제설명 소스코드 #include #include using namespace std; class XY { public: int x; int y; bool operator x x == arr.x) && (this->y > N; XY* arr = new XY[N]; for (int i = 0; i < N; ++i) cin ..

[C++] 백준 10867번 문제 (중복 빼고 정렬하기)
자료구조 & 알고리즘/BOJ2023. 7. 17. 18:16[C++] 백준 10867번 문제 (중복 빼고 정렬하기)

문제설명 소스코드 #include #include #include using namespace std; int main() { int N; vector arr; cin >> N; int input; for (int i = 0; i > input; arr.push_back(input); } sort(arr.begin(), arr.end()); arr.erase(unique(arr.begin(), arr.end()), arr.end()); for (int i = 0; i < arr.size(); ++i) cout 중복된 원소의 첫 번째 부터 벡터의 마지막까지를 지워버림

[C++] 백준 13단계 - 1427번 문제 (소트인사이드)
자료구조 & 알고리즘/BOJ2023. 7. 16. 18:16[C++] 백준 13단계 - 1427번 문제 (소트인사이드)

문제설명 소스코드 #include #include using namespace std; bool compare(int a, int b) { return a > b; } int main() { string N; cin >> N; sort(N.begin(), N.end(),compare); cout

image