ttps://mao.snuke.org/tasks/32 Problem 0032 - Log Run Stop Step Reset Submit mao.snuke.org 처음 생각은, o -> 0, 00 -> 1, 11 -> 2, ... 를 연쇄적으로 적용시키는 것이었다. 이렇게 연쇄적으로 적용시킨 다음에 남은 부스러기들을 지우면 해결이 된다고 봄. 그 생각을 충실히 옮겨서 20줄로 해결했다. o:0 00:1 11:2 22:3 33:4 44:5 #0:0_ #1:1_ #2:2_ #3:3_ #4:4_ #5:5_ _0:_ _1:_ _2:_ _3:_ _4:_ _5:_ _:: :# 근데 생각을 해보니, 00:1, 11:2 이렇게 합칠 필요가 없이 필요한 o 개수를 직접 나열하면 수 + o 의 조합으로 환원되게 만들 수 있..
https://mao.snuke.org/tasks/25 Problem 0025 - Balanced Statement You are given S contains only '(', ')'. Replace it with "yes" if it is correct parenthesis sequence, "no" otherwise. Correct parenthesis sequences are defined as follows. * An empty string is a correct parenthesis sequence. * If string A is a cor mao.snuke.org 모든 올바른 쌍을 먼저 제거하고 나면, (((( 꼴이거나 ))))) 꼴이거나 ))))((((( 꼴이 된다. 그래서 이 각각의 경우..
https://mao.snuke.org/tasks/10 Problem 0010 - Increment Run Stop Step Reset Submit mao.snuke.org 맨 처음에는 제일 간단한 생각부터 시작해서 짰다. 커서 하나 만들고 -> 맨 끝으로 옮기고 -> 맨끝에서 값 1 올리고 -> 그게 2가 되면 앞자리 1증가시켜주고 -> 반복. _0:0_ _1:1_ 0_::1 1_:2 02::10 12:20 2::10 :_ 그래서 이렇게 짰다. 8 라인. 조금 생각해보니, 2를 별도로 처리할 필요가 없을 것 같아 이 부분을 묶어서 처리하게 바꿨다. 커서를 맨 오른쪽으로 보내고 -> 보낸 다음 해당 커서를 +1을 나타내는 형태로 변경(_). 0_ 이 나오면 1로 바꾸고, 1_이 나오면 _0 으로 바꾸는 ..
https://mao.snuke.org/ Markov Algorithm Online Markov Algorithm quote from wikipedia: The Rules is a sequence of pair of strings, usually presented in the form of pattern → replacement. Each rule may be either ordinary or terminating. Given an input string: Check the Rules in order from top to bottom mao.snuke.org Markov Algorithm으로 문제를 푸는 사이트인데, 룰이 굉장히 단순하면서도 재밌다. 문제를 풀면서 재밌었던 포인트들을 까먹지 않게 기록해두..