-
Notifications
You must be signed in to change notification settings - Fork 5
240516 이현희 0x02 풀이 #1
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
Conversation
0x02/이현희/X보다_작은_수.java
Outdated
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.
전체적으로 저랑 똑같이 하셨네요!!!
저는 스캐너 대신 BufferedReader랑 StringTokenizer를 사용하였는데,
입출력시 속도 차이가 있어서, 나중엔 같은 구문이더라도, 스캐너를 사용하면
런타임 에러가 뜨는 경우가 있더라구요!!
이부분도 한 번 확인해보시면 좋을 것 같습니다!!
0x02/이현희/별_찍기_-_7.java
Outdated
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.
전 가운데까지 포함해서 위~ / 아래 이렇게 구현했었는데,
현희님 방식처럼 위 - 가운데 - 아래 도 깔끔하게 보기 좋네요!!
0x02/이현희/별_찍기_-_8.java
Outdated
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.
전 이부분 구현을 똑바로 못했어서
왼쪽공백 / 오른쪽 공백 느낌으로 반복문을 두 번 사용하였는데,
이렇게 구현하면 한번에 가능하네요!! 배워갑니다.
0x02/이현희/별_찍기_-_9.java
Outdated
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 (int i = 0; i <n; i++) { // 윗 삼각형
for (int j = 0; j < i; j++) { // 공백
sb.append(" ");
}
for (int j = 1; j <= 2*(n-i)-1; j++) { // 별
sb.append("*");
}
sb.append("\n"); // 줄 바꿈
}
큰 반복문 부분에서 저는 i값이 0부터 증가하는 것으로 구현하였는데,
현희님은 반대로 n-1부터 감소하는 느낌으로 구현하셨네요!
한 번 비교해보셔도 좋을 것 같아서 올려봅니다!
0x02/이현희/최댓값.java
Outdated
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.
저도 Collections를 응용해서 해결하고 싶었는데, 자꾸 오류가 나서 실패했었어요
Collections.sort만 생각했는데, max를 활용하는 건 생각 못했네요
배워갑니다.
240516 이현희 0x02 풀이