-
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
[장희직] Java vs C++, 1,2,3 더하기 4, 도어맨, 배열 복원하기, 후위 표기식2 #45
Conversation
|
||
class `Java vs C++` { | ||
|
||
data class JAVA(val variable: String) { |
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.
data class로 묶은 부분이 깔끔해서 좋았습니다!!
var mCount = 0 | ||
var isChanged = false | ||
|
||
kotlin.run { |
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.
그냥 run말고 kotlin.run도 있다는 것을 배웠습니다
readln().run { | ||
if (this.first().isLetter().not() || this.first().isLowerCase().not() || this.last() == '_' || this.contains("__")) { | ||
println("Error!") | ||
} else if (this.contains('_') && this.none { it.isUpperCase() }) { // CPP asd_asd |
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.
none 고차함수 배우고 갑니다!
@@ -0,0 +1,26 @@ | |||
package heejik.`9week` | |||
|
|||
// 답보풀: https://ku-hug.tistory.com/m/209 |
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.
좋은 자료 공유 감사합니다..!!
|
||
class `Java vs C++` { | ||
|
||
data class JAVA(val variable: String) { |
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 (i in 0 until h) { | ||
for (j in 0 until w) { | ||
if (i >= x && j >= y) { | ||
a[i][j] = b[i][j] - a[i-x][j-y] |
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.
중복된 부분에 대한 처리를 한 번에 처리한 것이 깔끔하네요..!!
|
||
fun solve() { | ||
readln().run { | ||
if (this.first().isLetter().not() || this.first().isLowerCase().not() || this.last() == '_' || this.contains("__")) { |
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.
isLetter 잘 배워갑니다!!
|
||
data class JAVA(val variable: String) { | ||
var cpp = "" | ||
fun toCPP(): String { |
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.
data class로 만들고 변환 함수 만드신 게 멋졌습니다!
|
||
fun solve() { | ||
readln().run { | ||
if (this.first().isLetter().not() || this.first().isLowerCase().not() || this.last() == '_' || this.contains("__")) { |
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.
isLetter 시리즈 유용해보이네요!
var isChanged = false | ||
|
||
kotlin.run { | ||
order.forEachIndexed { index, _c -> |
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.
_c로 받은 다음에 var c = _c 하는 게 아이디어 좋다고 생각했습니다!
println(answer) | ||
} | ||
|
||
private fun Char.change() = if (this == 'W') 'M' else 'W' |
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.
확장함수 👍👍
postfix = postfix.map { | ||
if (it.contains('A' + cnt)) num | ||
else it | ||
}.toMutableList() |
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.
map으로 입력 받으면서 바로 대입한 게 멋졌습니다!
📌 from issue #41 📌
📋문제 목록📋