문제설명 소스코드 map을 이용 #include #include using namespace std; int main(void) { map m; int aSize, bSize; cin >> aSize >> bSize; for (int i = 0; i > input; m.insert(pair(input, true)); //입력받은 값과 true를 맵에 저장 } int count = 0; //교집합 개수를 저장 for (int i = 0; i > input; if (m[input] == true) count++; //맵에 해당하는 값이 있으면 count를 1증가 } cout > aSize >> ..
문제설명 소스코드 #include #include #include using namespace std; int main() { ios_base::sync_with_stdio(false); //표준 스트림 동기화 해제 cin.tie(0); //입출력 연결 끊기 vectorv1, v2; int N, M; cin >> N >> M; for (int i = 0; i > input; v1.push_back(input); } sort(v1.begin(), v1.end()); //v1 정렬 for (int i = 0; i > input; if (binary_search(v1.begin(), v1.end(),..
문제설명 소스코드 #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); //표준 스트림 동기화 해제 cin.tie(nullptr); //입출력 연결 끊기 map m; int N, M; cin >> N; for (int i = 0; i > input; ++m[input]; } cin >> M; for (int i = 0; i > input; cout
문제설명 소스코드 #include #include using namespace std; int main(void) { map m; int N, M; int count = 0; cin >> N >> M; for (int i = 0; i > str; m.insert(pair(str, true)); } for (int i = 0; i > str; if (m[str] == true) count++; } cout
문제설명 소스코드 #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
문제설명 소스코드 #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 < ..
문제설명 소스코드 #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..
문제설명 소스코드 #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 ..