Information Security Study
[CodeUp][Python 기초 100제] 6091~6095 문제를 풀면서 알게 된 점 본문
6091~6095번 문제에서 알게 된 점
1. 종합 문제
# 세 명의 문제 푸는 주기가 같아지는 날을 구하기
a, b, c = map(int, input().split())
# a, b, c는 세 명이 각각 문제 푸는 주기
day = 1
while True:
if (day % a == 0) and (day % b == 0) and (day % c == 0):
print(day)
break
else:
day += 1
2. 리스트 문제
# 입력값 중 겹치는 수 카운트하기
# 호출 횟수 입력
n = int(input())
# 호출된 번호들을 리스트에 저장 (공백으로 구분된 n개의 숫자)
tmp_list = list(map(int, input().split()))
# 1번부터 23번까지의 출석 횟수를 0으로 초기화
counts = [0] * 23 # 리스트 길이 23, 모두 0
# 호출된 번호의 빈도수를 센다
for num in tmp_list: # num 은 1~23
counts[num - 1] += 1 # 인덱스는 0~22이므로 -1
# 공백을 사이에 두고 한 줄로 출력
print(*counts)
# 입력값 거꾸로 출력하기
n = int(input())
num_list = list(map(int, input().split()))
for i in range(n-1, -1, -1): # (시작 수, 끝 수, 증감) 시작 수는 포함하고 끝 수는 포함하지 않는다. n-1부터 0까지 감소한다는 뜻이다.
print(num_list[i], end=' ')
# 입력 리스트 중 최솟값 찾아 출력하기
n = int(input())
n_list = list(map(int, input().split()))
min = n_list[0]
for i in range(n):
if n_list[i] <= min:
min = n_list[i]
print(min)
# 2차원 배열
n = int(input())
empty_list = list()
for i in range(20):
empty_list.append([])
for j in range(20):
empty_list[i].append(0)
for i in range(n):
x, y = map(int, input().split())
empty_list[x][y] = 1
for i in range(1, 20):
for j in range(1, 20):
print(empty_list[i][j], end=' ')
print()
'Programming > Python' 카테고리의 다른 글
[CodeUp][Python 기초 100제] 6096~6098 문제를 풀면서 알게 된 점 (0) | 2025.06.11 |
---|---|
[CodeUp][Python 기초 100제] 6081~6090 문제를 풀면서 알게 된 점 (0) | 2025.06.09 |
[CodeUp][Python 기초 100제] 6061~6080 문제를 풀면서 알게 된 점 (0) | 2025.06.07 |
[CodeUp][Python 기초 100제] 6031~6060 문제를 풀면서 알게 된 점 (0) | 2025.06.06 |
[CodeUp][Python 기초 100제] 6001~6030 문제를 풀면서 알게 된 점 (0) | 2025.03.30 |