-
Notifications
You must be signed in to change notification settings - Fork 0
FEAT: 프로그래머스 카펫 - 완전탐색 #10
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
base: main
Are you sure you want to change the base?
Conversation
|
아ㅏ 제가 자꾸 브랜치 분기를 이상한데서 해서 다른 파일이 딸려오네요.. 킼킼 지송쓰!!! 담부터 더 주의하겠습니다!! |
jis-kim
left a comment
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.
브랜치 다음부터 조심해라 ㅡㅡ 수고하셨어요~
| // y = brownSum - x; | ||
| int brownSum = (brown - 4) / 2; | ||
|
|
||
| for (int i = 0; i < 2500; 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.
전 0인 경우는 존재하지 않는다고 생각해서( 이유 : yellow 가 1 이상이면 그럴 일이 없습니다) 3부터 돌아줬읍니당
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.
맞아요ㅋㅎㅋㅎ 사실 2500까지도 안갔어도 됐을 것 같습니다ㅎㅎㅎ 반성반성
| for (int i = 0; i < 2500; i++) { | ||
| if (i * (brownSum - i) == yellow) { | ||
| x = i; | ||
| break; |
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.
이거 걍 i 를 밖에서 선언하고 break 해서 그대로 써도 됐을 듯 합니다!! 하지만 이정도는 취향일지도ㅎㅎ
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.
지수님 처럼! 맞아여 for문안에서 return 할 생각을 못함ㅋㅋㅋ
aLVINlEE9
left a comment
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.
멋지십니다!!
너비를 주고 가로세로를 구하라고 해서 가로세로를 미지수로 놓고 방정식을 이용했습니다.
노랑이 x ,y 일때 브라운이 x+2, y+2 를 가로세로로 가지게 되니까요.
변수명을 좀 거지같이 지었는데 brownSum은 갈색의 가로+세로 입니다..ㅋㅋ
