본문 바로가기

백준1064

백준 31610 飴の袋詰め (Drops Packing) https://www.acmicpc.net/problem/31610 31610번: 飴の袋詰め (Drops Packing) 1 個 A 円の飴を B 個と,C 円の袋を 1 つ買う.合計金額はいくらか求めよ. www.acmicpc.net 1234567891011def sol(a, b, c): return a * b + c if __name__ == '__main__': a = int(input()) b = int(input()) c = int(input()) print(sol(a, b, c)) cs 2024. 4. 15.
백준 31611 火曜日 (Tuesday) https://www.acmicpc.net/problem/31611 31611번: 火曜日 (Tuesday) 今日の X 日後が火曜日であるならば 1 を,そうでないならば 0 を出力せよ. 答え以外は何も出力しないこと.(入力を促す文章なども出力しないこと.) www.acmicpc.net 1234567891011def sol(x): if x % 7 == 2: return 1 else: return 0 if __name__ == '__main__': x = int(input()) print(sol(x)) cs 2024. 4. 15.
백준 31614 分 (Minutes) https://www.acmicpc.net/problem/31614 31614번: 分 (Minutes) 整数 H, M が与えられる. H 時間 M 分が何分かを求めよ. www.acmicpc.net 123456789def sol(h, m): return h * 60 + m if __name__ == '__main__': h = int(input()) m = int(input()) print(sol(h, m)) cs 2024. 4. 15.
백준 31654 Adding Trouble https://www.acmicpc.net/problem/31654 31654번: Adding Trouble Your friend Bob is really bad at adding numbers, and he’d like some help to make sure he’s doing it correctly! Can you help Bob make sure he is adding correctly? Given 3 integers $A$, $B$, $C$, make sure that $A + B = C$, and that Bob indeed added $A$ www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 def sol(a, b, c): if a + b == c: return "corr.. 2024. 4. 15.
백준 31450 Everyone is a winner https://www.acmicpc.net/problem/31450 31450번: Everyone is a winner Your friend is a kindergarten teacher. Since the Olympic Games in Paris are approaching, he wants to teach the kids about different aspects of sports competitions. As part of this idea, he plans to have one day when kids receive medals for their behaviour www.acmicpc.net 1234567891011def sol(m, k): if m % k == 0: return "Yes" els.. 2024. 3. 31.
백준 31429 SUAPC 2023 Summer https://www.acmicpc.net/problem/31429 31429번: SUAPC 2023 Summer SUAPC 2023 Summer에서 $N$등을 한 팀이 푼 문제 수와 푼 문제들의 페널티의 합을 공백으로 구분하여 출력한다. 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(n): answer = {1: [12, 1600] , 2: [11, 894] , 3: [11, 1327] , 4: [10, 1311] , 5: [9, 1004] , 6: [9, 1178] , 7: [9, 1357] , 8: [8, 837] , 9: [7, 1055] , 10: [6, 556] , 11: [6, 773]} return an.. 2024. 2. 26.
백준 10798 세로읽기 https://www.acmicpc.net/problem/10798 10798번: 세로읽기 총 다섯줄의 입력이 주어진다. 각 줄에는 최소 1개, 최대 15개의 글자들이 빈칸 없이 연속으로 주어진다. 주어지는 글자는 영어 대문자 ‘A’부터 ‘Z’, 영어 소문자 ‘a’부터 ‘z’, 숫자 ‘0’ www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 def sol(strings): answer = '' for i in range(15): for s in strings: if s: answer += s[0] s.pop(0) else: continue return answer if __name__ == '__main__': strings = [list(input()) f.. 2024. 2. 15.
백준 Not A + B https://www.acmicpc.net/problem/23530 23530번: Not A + B You are required to output an integer $c$ for each test in a separate line. If there are multiple solutions, you may output any of them. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 def sol(a, b): return 1 if __name__ == '__main__': t = int(input()) for i in range(t): a, b = map(int, input().split()) print(sol(a, b)) Colored by Color Scripter cs a와.. 2024. 2. 9.
백준 27465 소수가 아닌 수 https://www.acmicpc.net/problem/27465 27465번: 소수가 아닌 수 이 대회의 운영진 중 한 명인 KSA 학생은 $17$시와 $19$시를 구별할 수 없다. 이는 당연하게도 $17$과 $19$가 모두 소수이기 때문일 것이다. 시간을 제대로 구별해서 KSA의 명예를 지키기 위해 정수 $N$ www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 def sol(n): return 10**9 # if n % 2 == 0: # return n + 2 # else: # return n + 3 if __name__ == '__main__': n = int(input()) print(sol(n)) cs 소수인 수를 찾으려면 에라토스테네스의 체나,, 반복문을 사용해야 .. 2024. 2. 9.
백준 14215 세 막대 https://www.acmicpc.net/problem/14215 14215번: 세 막대 첫째 줄에 a, b, c (1 ≤ a, b, c ≤ 100)가 주어진다. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 def sol(a, b, c): for x in range(a, 0, -1): for y in range(b, 0, -1): for z in range(c, 0, -1): if x + y + z - max(x, y, z) > max(x, y, z): return x + y + z if __name__ == '__main__': a, b, c = map(int, input().split()) print(sol(a, b, c)) Colored by Color Script.. 2024. 2. 8.
백준 1308 D-Day https://www.acmicpc.net/problem/1308 1308번: D-Day 첫째 줄에 오늘의 날짜가 주어지고, 두 번째 줄에 D-Day인 날의 날짜가 주어진다. 날짜는 연도, 월, 일순으로 주어지며, 공백으로 구분한다. 입력 범위는 1년 1월 1일부터 9999년 12월 31일 까지 이다. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 from datetime import date def sol(date1, date2, new_date1): different_date = (date2 - date1).days over_thousand = (date2 - new_date1).days if over_thousand >=.. 2024. 2. 8.
백준 25206 너의 평점은 https://www.acmicpc.net/problem/25206 25206번: 너의 평점은 인하대학교 컴퓨터공학과를 졸업하기 위해서는, 전공평점이 3.3 이상이거나 졸업고사를 통과해야 한다. 그런데 아뿔싸, 치훈이는 깜빡하고 졸업고사를 응시하지 않았다는 사실을 깨달았다! 치 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 def sol(scores): grades = {'A+': 4.5, 'A0': 4.0, 'B+': 3.5, 'B0': 3.0, 'C+': 2.5, 'C0': 2.0, 'D+': 1.5, 'D0': 1.0, 'F': 0.0} total_gpa = total_class = 0 for score .. 2024. 2. 6.