Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[정렬_맵_셋] 8월 23일 #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

[정렬_맵_셋] 8월 23일 #1

wants to merge 2 commits into from

Conversation

wonnn25
Copy link
Collaborator

@wonnn25 wonnn25 commented Aug 23, 2023

인적사항

학번: 2171060
이름: 김예원

과제제출

기존 제출: 1431, 14425
추가 제출: 19636

Copy link

@kwakrhkr59 kwakrhkr59 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[정렬, 맵, 셋 구현 추가제출 확인 완료]
안녕하세요 예원님~ 필수 구현 뮨제(19636) 추가제출 확인 완료되셨습니다! 수고 많으셨습니다~

Copy link

@sawoll sawoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: 안녕하세요 예원님! 필수 문제 1431번, 14425번 코드리뷰 완료했습니다.😊 두 문제 모두 잘 풀어 주셔서 특별히 코멘트 남겨드릴 만한 부분은 많이 없었습니다! 간단한 제안사항을 코멘트로 남겨 드렸으니 확인해보시면 좋을 것 같습니다. 수고하셨어요:)👍👍

Comment on lines +7 to +17
int sum(string a) {
int result = 0;

for (int i = 0; i < a.length(); i++) {
int anum = a[i] - '0';//string to int
if (anum >= 0 && anum <= 9) { //�����̸� ����
result = result + anum;
}
}
return result;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

자릿수 합 구하는 함수 따로 구현하신 것 너무 좋아요!😍 문자의 숫자 여부를 판별할 때 string헤더의 isdigit 함수를 사용하는 방법도 알아두시면 편리할 것 같습니다.👍👍

Comment on lines +24 to +28
int asum = sum(a);
int bsum = sum(b);
if (asum != bsum) { //(���� ������) �ڸ��� �� ���� �� ����
return asum < bsum;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if와 return에서 asum과 bsum 대신 sum함수를 바로 호출한다면 더 간결한 코드가 될 수 있을 것 같습니다!😀

Comment on lines +25 to +28
auto iter = s.find(str); //key�� ���� ���� Ȯ��
if (iter != s.end()) { //�����ϸ� cnt 1 ����, (�������� ������ s.end()�� ��ȯ��)
cnt++;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

반복자를 이용하여 순회를 잘 구현해 주셨네요😊

Comment on lines +11 to +20
map<string, int> s;

//�Է�
cin >> n >> m;

for (int i = 0; i < n; i++) { //���� S�� map���� ����
cin >> str;
s[str] = value;
value++;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map을 사용해서 문제를 잘 풀어 주셨습니다!😍 샘플 코드 참고하셔서 set으로 푸는 방법도 한 번 알아보시면 좋을 것 같아요~👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants