본문 바로가기

코딩테스트/Python

[코드업] 파이썬 기초 100제 91~100

91.

a,b,c = input().split()

d = 1

while True:
    if d%int(a)==0 and d%int(b)==0 and d%int(c)==0:
        print(d)
        break
    d+=1

 

92.

n = int(input())
a = input().split()

arr = [0 for i in range(23)]

for i in a:
    arr[int(i)-1]+=1

for i in arr:
    print(i, end=" ")

 

93.

n = int(input())
a = input().split()

a.reverse()

for i in a:
    print(i,end=" ")

 

94.

n = int(input())
a = input().split()

a = list(map(lambda x:int(x),a))
a.sort()

print(a[0])

 

95.

arr = [[0 for i in range(19)] for j in range(19)]

n = int(input())

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

for i in range(19):
    for j in range(19):
        print(arr[i][j], end=" ")
    print()

 

96.

arr = []
for i in range(19):
    a = input().split()
    a = list(map(lambda x:int(x),a))
    arr.append(a)

n = int(input())

for i in range(n):
    x,y = input().split()
    x = int(x)
    y = int(y)

    for j in range(19):
        arr[j][y-1] = 1 if arr[j][y-1] == 0 else 0
        arr[x-1][j] = 1 if arr[x-1][j] == 0 else 0        

for i in range(19):
    for j in range(19):
        print(arr[i][j],end=" ")
    print()

 

97.

size = input().split()
n = int(input())

arr = [[0 for i in range(int(size[1]))] for j in range(int(size[0]))]

for i in range(n):
    l,d,x,y = input().split()
    l = int(l)
    d = int(d)
    x = int(x)
    y = int(y)

    for j in range(l):
        if d==0:
            arr[x-1][y-1+j] = 1
        else:
            arr[x-1+j][y-1] = 1

for i in range(int(size[0])):
    for j in range(int(size[1])):
        print(arr[i][j],end=" ")
    print()

 

98.

arr = []

for i in range(10):
    a = input().split()
    a = list(map(lambda x:int(x),a))
    arr.append(a)

x=1
y=1

while True:
    arr[x][y] = 9
    
    if arr[x][y+1] == 0:
        y+=1
        arr[x][y] = 9
    elif arr[x][y+1] == 1:
        if arr[x+1][y] == 0:
            x+=1
            arr[x][y] = 9
        elif arr[x+1][y] == 1:
            break
        elif arr[x+1][y] == 2:
            arr[x+1][y] = 9
            break
    elif arr[x][y+1] == 2:
        y+=1
        arr[x][y] = 9
        break

for i in range(10):
    for j in range(10):
        print(arr[i][j],end=" ")
    print()