본문 바로가기
Algorithm

[Codeup] Python 기초 100제(5)

by Jiseong 2021. 5. 26.

 

[6095]

n = int(input())
d = []
for i in range(20):
    d.append([])
    for j in range(20):
        d[i].append(0)

for i in range(n):
    x, y = map(int,input().split())
    d[x][y] = 1

for i in range(1,20):
    for j in range(1,20):
        print(d[i][j],end=' ')
    print()

 

[6096]

d = [[]*19 for _ in range(19)]

for i in range(19): # 0~18
    d[i] = list(map(int, input().split()))

n = int(input())

for i in range(n):
    x, y = map(int,input().split()) # 좌표 입력
    for j in range(19):
        if d[x-1][j] == 1: #배열 중심으로 생각하면 -1 해줘야함
            d[x-1][j] = 0
        else:
            d[x-1][j] = 1
        
        if d[j][y-1] == 1:
            d[j][y-1] = 0
        else:
            d[j][y-1] = 1

# for i in range(20):
#     for j in range(20):
#         print(d[i][j])
for i in range(19):
    for j in range(19):
        print(d[i][j],end=' ')
    print()

 

[6097]

h, w = map(int, input().split())
a = []
for i in range(h):
    a.append([])
    for j in range(w):
        a[i].append(0)

n = int(input())

for i in range(n):
    l, d, x, y = map(int, input().split())
    if d == 0:
        for j in range(l):
            a[x-1][y-1+j] = 1
    elif d == 1:
        for j in range(l):
            a[x-1+j][y-1] = 1
    else: break

for i in range (h):
    for j in range(w):
        print(a[i][j], end=' ')
    print()

 

2021.05.25 - [Dev/Algorithm] - [Codeup] Python 기초 100제(4)

 

[Codeup] Python 기초 100제(4)

[6084] h, b, c, s = map(int, input().split()) bit = h * b * c * s #bit mbyte = float(bit / 8 / 1024 / 1024) #MB print(format(mbyte,".1f"),"MB") [6085] w, h, b = map(int, input().split()) bit = w *..

limjs-dev.tistory.com

 

'Algorithm' 카테고리의 다른 글

Baekjoon - if  (0) 2021.05.30
[Codeup] Python 기초 100제(6)  (0) 2021.05.27
[Codeup] Python 기초 100제(4)  (0) 2021.05.25
[Codeup] Python 기초 100제(3)  (0) 2021.05.24
[Codeup] Python 기초 100제(2)  (0) 2021.05.22

댓글