728x90
    
    
  SMALL
    
n, m = map(int, input().split())
h = 3
w = 8
n *= h
m *= w
paper = [list(input()) for _ in range(n)]
for height in range(0, n, h):
    for width in range(0, m, w):
        a = int(paper[height + 1][width + 1])
        b = int(paper[height + 1][width + 3])
        c = int(paper[height + 1][width + 5])
        if paper[height + 1][width + 6] != '.':
            c = c * 10 + int(paper[height + 1][width + 6])
        if a + b == c:
            len_mark = 7 if c >= 10 else 6
            paper[height + 1][width] = '*'
            paper[height + 1][width + len_mark] = '*'
            for i in range(1, len_mark):
                paper[height][width + i] = '*'
                paper[height + 2][width + i] = '*'
        else:
            for i in range(3):
                paper[height + i][width + 3 - i] = '/'
for row in paper:
    print(''.join(row))
- 3행 8열 단위로 입력을 순회하며 식을 뽑아내는 것과,
 - c가 두 자리인 경우만 잘 처리해주면 그 외에는 인덱싱만 진행하는 구현 문제이기에 어렵지 않게 접근할 수 있습니다.
 
728x90
    
    
  LIST
    '알고리즘 문제 풀이 > 랜덤 마라톤 (solved.ac)' 카테고리의 다른 글
| 🥈 27648번: 증가 배열 만들기 (0) | 2024.08.08 | 
|---|---|
| 🥈 13413번: 오셀로 재배치 (2) | 2024.08.05 | 
| 🥈 21760번: 야구 시즌 (0) | 2024.07.26 | 
| 🥉 5586번: JOI와 IOI (3) | 2024.07.25 | 
| 🥈 9184번: 신나는 함수 실행 (0) | 2024.07.23 |