[C++] 백준 1302 베스트셀러
·
Algorithm/Baekjoon
#include #include #include #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); map book; string name; int n, m = 0; cin >> n; while (n > 0) { cin >> name; book[name] += 1;//있거나 없으면 1추가 *중복된 이름이 없음 n--; } name = ""; for (auto ptr = book.begin(); ptr != book.end(); ptr++) {//first와 second불러오면서 비교 if (m second)//값이 max인것의 이름을 계속적어줌 { m = ptr->second; name =..