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

[장희직] Java vs C++, 1,2,3 더하기 4, 도어맨, 배열 복원하기, 후위 표기식2 #45

Merged
merged 5 commits into from
Nov 13, 2022

Conversation

jhg3410
Copy link
Member

@jhg3410 jhg3410 commented Nov 13, 2022

📌 from issue #41 📌

📋문제 목록📋

Java vs C++: ✅
1,2,3 더하기 4: ⛔️
도어맨: ✅
배열 복원하기: ✅
후위 표기식2: ✅

@jhg3410 jhg3410 added the 희직 label Nov 13, 2022

class `Java vs C++` {

data class JAVA(val variable: String) {
Copy link
Member

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 {
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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) {
Copy link
Member

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]
Copy link
Member

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("__")) {
Copy link
Member

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 {
Copy link
Contributor

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("__")) {
Copy link
Contributor

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 ->
Copy link
Contributor

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'
Copy link
Contributor

Choose a reason for hiding this comment

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

확장함수 👍👍

Comment on lines +13 to +16
postfix = postfix.map {
if (it.contains('A' + cnt)) num
else it
}.toMutableList()
Copy link
Contributor

Choose a reason for hiding this comment

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

map으로 입력 받으면서 바로 대입한 게 멋졌습니다!

@jhg3410 jhg3410 merged commit a0b2c26 into main Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants