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

[맵, 셋] 9월 12일 #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

[맵, 셋] 9월 12일 #2

wants to merge 1 commit into from

Conversation

aqswa
Copy link
Collaborator

@aqswa aqswa commented Sep 12, 2021

No description provided.

@aqswa aqswa changed the title Add files via upload [맵, 셋] 9월 7일 Sep 12, 2021
@aqswa aqswa changed the title [맵, 셋] 9월 7일 [맵, 셋] 9월 12일 Sep 12, 2021
Copy link

@bsa0322 bsa0322 left a comment

Choose a reason for hiding this comment

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

p2. 너무 너무 잘해주셨어요!!!! 제가 거의 드릴 말씀이 없었습니다... 19636 음수 나눗셈 처리하는 부분만 수정 후 저 다시 불러주세요~! 수고하셨습니다~!!

}
else{
for(int i = 1; i <= a.length(); i++)
cout << res[i];
Copy link

Choose a reason for hiding this comment

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

string을 가공하지 않고 너무 잘 풀어주셨어요!!!! 👍 가독성 면에서 조금 코멘트를 드리자면, res 벡터를 push_back 으로 일의 자리 수부터 저장한 후, 끝에서부터 출력하는 형태로 하면 출력을 하나로 합칠 수 있어요!!

cin >> n >> m;

string a;
for(int i=0; i<n; i++){
Copy link

Choose a reason for hiding this comment

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

n, m 은 다시 쓰지 않으니 while(n--) 으로 입력 받아도 좋을 것 같아요~!

}

//출력
cout << cnt << '\n';
Copy link

Choose a reason for hiding this comment

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

cnt 변수 사용도 좋지만, ans 만으로도 크기를 알 수 있는 방법이 있죠!

//
// Created by LG on 2021-09-12.
//

Copy link

Choose a reason for hiding this comment

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

앗 4385 문제는 아직 못 푸신 걸까요..!?

Comment on lines +6 to +12
//음수를 2로 나눈 몫
int divideByTwo(int num){
int q = 0;
while(2*q-num > 0)
q--;
return q;
}
Copy link

Choose a reason for hiding this comment

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

p2. 음수를 2로 나눈 몫을 잘 처리해주셨어요! 하지만 반복문의 사용 없이 한 번의 연산 만으로 처리할 수 있는 방법이 있어요. -5/2를 하면 -3이 나와야 하는데, c++에선 -2가 나오죠! 어떻게 하면 좋을까요? 아니면 floor 함수에 대해 알아봐도 좋을 것 같아요.

//입력
for(int i=0; i<n; i++){
cin >> name >> type;
wear[type]++;
Copy link

Choose a reason for hiding this comment

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

필요한 정보를 아주 잘 캐치해주셨어요~!!👍

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.

2 participants