20250519 baekjoon

This commit is contained in:
songyc macbook 2025-05-19 20:51:01 +09:00
parent 55bec15510
commit 397a1d25df
10 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,8 @@
n = int(input())
arr = list(input().split(" "))
# v = input()
# c = 0
# for i in range(n):
# if arr[i]==v : c+=1
# print(c)
print(arr.count(input()))

View File

@ -0,0 +1,6 @@
n, m = map(int, input().split())
arr = [0]*n
for _ in range(m):
i, j, k = map(int,input().split())
arr[i-1:j] = [k]*(j-i+1)
print(*arr)

View File

@ -0,0 +1,8 @@
n, m = map(int,input().split())
arr = list(range(1,n+1))
temp = list()
for _ in range(m):
i, j = map(int, input().split())
temp = arr[i-1:j]
arr[i-1:j] = temp[::-1]
print(*arr)

View File

@ -0,0 +1,8 @@
n, m = map(int, input().split())
arr = list(range(1,n+1))
for _ in range(m):
i, j = map(int, input().split())
temp = arr[i-1]
arr[i-1] = arr[j-1]
arr[j-1] = temp
print(*arr)

View File

@ -0,0 +1,3 @@
n = int(input())
arr = list(map(int, input().split(" ")))
print(min(arr), max(arr))

View File

@ -0,0 +1,4 @@
n, x = map(int, input().split(" "))
arr = list(map(int, input().split(" ")))
for i in range(n):
if arr[i] < x : print(arr[i], end=" ")

View File

@ -0,0 +1,5 @@
n = int(input())
arr = list(map(int, input().split()))
m = max(arr)
arr = [arr[i]/m*100 for i in range(n)]
print(sum(arr)/n)

View File

@ -0,0 +1,7 @@
max = 0
for i in range(9):
n = int(input())
if max < n :
max = n
idx = i+1
print(max, idx,sep="\n")

View File

@ -0,0 +1,4 @@
arr = set()
for i in range(10):
arr.add(int(input())%42)
print(len(arr))

View File

@ -0,0 +1,4 @@
arr = list(range(1,31))
for _ in range(28):
arr.remove(int(input()))
print(*arr, sep="\n")