-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
The head ref may contain hidden characters: "\uB9F5,-\uC14B"
Conversation
There was a problem hiding this 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]; |
There was a problem hiding this comment.
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++){ |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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. | ||
// | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 4385 문제는 아직 못 푸신 걸까요..!?
//음수를 2로 나눈 몫 | ||
int divideByTwo(int num){ | ||
int q = 0; | ||
while(2*q-num > 0) | ||
q--; | ||
return q; | ||
} |
There was a problem hiding this comment.
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]++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
필요한 정보를 아주 잘 캐치해주셨어요~!!👍
No description provided.