본문 바로가기

백준1054

백준 13698 Hawk eyes https://www.acmicpc.net/problem/13698 13698번: Hawk eyes 첫째 줄에 재열이가 컵을 섞는 순서가 주어진다. 이 순서는 위 그림에 있는 A, B, C, D, E, F 중 하나이다. 재열이는 컵을 최대 200번 섞는다. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 if __name__ == '__main__': change = input() changes = [[0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3]] cups = ['small', 'X', 'X', 'big'] for c in change: type_change = ord(c) - 65 start, end = changes[type_chang.. 2023. 2. 27.
백준 26575 Pups https://www.acmicpc.net/problem/26575 26575번: Pups Congratulations, you adopted some little puppies! Now you just need to go grab food for them at the store. Your vet tells you how many pounds of food each pup will eat before your next trip to the store, so you just need to calculate the total amount of fo www.acmicpc.net 1 2 3 4 5 6 if __name__ == '__main__': n = int(input()) for _ in range(n):.. 2023. 2. 27.
백준 26471 Farma https://www.acmicpc.net/problem/26741 26741번: Farma Bajtek ma farmę a na niej pewną liczbę kur i krów. Razem wszystkie te zwierzęta mają dokładnie X głów oraz Y nóg. Wszystkie kury mają po dwie nogi, a wszystkie krowy mają po cztery nogi. Oczywiście zarówno kury, jak i krowy mają po jednej g www.acmicpc.net 1 2 3 4 5 6 7 8 9 def sol(x, y): return int((4 * x - y) / 2), -int((2 * x - y) / 2) if __.. 2023. 2. 24.
백준 9771 Word Searching https://www.acmicpc.net/problem/9771 9771번: Word Searching The first line contains a single word to search. A word contains at most 20 characters. The next line and the rest is a text to search for that word. The text can contain up to 100 lines including blank lines. No line exceeds 250 characters. A word cannot www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 if __name__ == '__main__': target = i.. 2023. 2. 24.
백준 9773 ID Key https://www.acmicpc.net/problem/9773 9773번: ID Key บรรทัดแรกคือค่า N (1 ≤ N ≤ 100) ระบุจํานวนคน และ N บรรทัดต่อมา แต่ละบรรทัดคือเลขประจําตัวประชาชน 13 ห www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 def sol(s) -> int: first, last_three_number = 0, 0 for i in s: first += int(i) last_three_number = int(s[-3] + s[-2] + s[-1]) * 10 answer = first + last_three_number if first + answer 2023. 2. 21.
백준 9772 Quadrants https://www.acmicpc.net/problem/9772 9772번: Quadrants Given the coordinates (x,y) of some points in 2-dimensional plane, find out which quadrant(Q1-Q4) the points are located. If a point is located on X-axis or Y-axis, print out AXIS instead. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 def sol(x, y): if x == 0 or y == 0: return 'AXIS' elif x > 0 and y > 0: return 'Q1' elif.. 2023. 2. 17.
백준 27389 Metronome https://www.acmicpc.net/problem/27389 27389번: Metronome A Metronome is a mechanical device used by musicians for keeping time. It is a very clever device, based on a spring, an inverted pendulum, and an escapement gear. Milo is learning to play the glockenspiel, and has purchased a metronome to help him keep ti www.acmicpc.net 1 2 3 4 5 6 7 8 def sol(n): answer = round(n/4, 2) return answer if _.. 2023. 2. 9.
백준 27434 팩토리얼 3 https://www.acmicpc.net/problem/27434 27434번: 팩토리얼 3 0보다 크거나 같은 정수 N이 주어진다. 이때, N!을 출력하는 프로그램을 작성하시오. www.acmicpc.net 1 2 3 4 5 6 from math import factorial if __name__ == '__main__': n = int(input()) print(factorial(n)) cs 2023. 2. 9.
백준 27433 팩토리얼 2 https://www.acmicpc.net/problem/27433 27433번: 팩토리얼 2 0보다 크거나 같은 정수 N이 주어진다. 이때, N!을 출력하는 프로그램을 작성하시오. www.acmicpc.net 1 2 3 4 5 6 from math import factorial if __name__ == '__main__': n = int(input()) print(factorial(n)) cs 2023. 2. 9.
백준 25630 팰린드롬 소떡소떡 https://www.acmicpc.net/problem/25630 25630번: 팰린드롬 소떡소떡 소떡소떡은 기다란 꼬치에 소세지와 떡을 끼운 음식이다. 편의상 소떡소떡을 알파벳 s와 t로만 구성된 길이 $N$의 문자열로 생각하자. 알파벳 s는 소세지를, t는 떡을 의미한다. 위 그림은 길이가 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 def sol(n, s): answer = 0 if n % 2 == 0: left, right = s[:n // 2], s[n // 2:][::-1] else: left, right = s[:n // 2], s[n // 2 + 1:][::-1] for i in range(n // 2): if left[i] !=.. 2023. 2. 8.
백준 27332 11 月 (November) https://www.acmicpc.net/problem/27332 27332번: 11 月 (November) 2022 年 11 月 3 日の 4 週間後の日は 2022 年 12 月 1 日である.この日は 2022 年 11 月ではないので 0 を出力する. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 import datetime def sol(a, b): current_date = datetime.date(2022, 11, a) weeks = datetime.timedelta(weeks=b) that_day = current_date + weeks if that_day.year == 2022 and that_day.month == 11: ret.. 2023. 2. 1.
백준 27294 몇개고? https://www.acmicpc.net/problem/27294 27294번: 몇개고? 첫 번째 줄에 시간을 의미하는 정수 $T$ ($0 \le T \le 23$)와 술의 유무를 의미하는 정수 $S$ ($0 \le S \le 1$)가 공백으로 구분되어 주어진다. $T$가 $11$이하이면 아침 시간, $12$이상 $16$ 이하이면 점심 시 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 def sol(t, s): if t>=12 and t 2023. 1. 31.