본문 바로가기

백준1054

백준 27328 三方比較 (Three-Way Comparison) https://www.acmicpc.net/problem/27328 27328번: 三方比較 (Three-Way Comparison) 2 つの整数 A, B が与えられる. A と B の大小を比較し,A < B ならば -1 を,A = B ならば 0 を,A > B ならば 1 を出力せよ. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 def sol(a, b): if a>b: return 1 elif a == b: return 0 else: return -1 if __name__ == '__main__': a = int(input()) b = int(input()) print(sol(a, b)) cs 2023. 1. 31.
백준 27327 時間 (Hour) https://www.acmicpc.net/problem/27327 27327번: 時間 (Hour) X 日は何時間か,単位 (時間) を省いて出力せよ. www.acmicpc.net 1 2 3 4 5 6 7 8 9 def sol(n): answer = n*24 return answer if __name__ == '__main__': n = int(input()) print(sol(n)) cs 2023. 1. 31.
백준 27331 2 桁の整数 (Two-digit Integer) https://www.acmicpc.net/problem/27331 27331번: 2 桁の整数 (Two-digit Integer) 2 つの数字 A, B が与えられる. 十の位が A であり,一の位が B である 2 桁の正の整数を出力せよ. www.acmicpc.net 1 2 3 4 5 6 7 8 9 def sol(a, b): return a+b if __name__ == '__main__': a = str(input()) b = str(input()) print(sol(a, b)) cs 2023. 1. 31.
백준 27324 ゾロ目 (Same Numbers) https://www.acmicpc.net/problem/27324 27324번: ゾロ目 (Same Numbers) N の十の位の数字と一の位の数字が同じである場合は 1 を,そうでない場合は 0 を出力せよ. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 def sol(n): if n%10 == n//10 : return 1 else: return 0 if __name__ == '__main__': n = int(input()) print(sol(n)) cs 2023. 1. 31.
백준 27323 長方形 (Rectangle) https://www.acmicpc.net/problem/27323 27323번: 長方形 (Rectangle) 整数 A, B が与えられる.縦の辺の長さが A cm,横の辺の長さが B cm である下図のような長方形の面積は何 cm2 か求めよ. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 def sol(a, b): answer = a * b return answer if __name__ == '__main__': a = int(input()) b = int(input()) print(sol(a, b)) cs 2023. 1. 31.
백준 26560 Periods https://www.acmicpc.net/problem/26560 26560번: Periods Eric gets distracted so sometimes he forgets to put periods at the end of his sentences. To help him out, you are to put a period at the end of his sentences if the period is not already present. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 def sol(s): if s[-1] != '.': return s + '.' else: return s if __name__ == '__main__': n = int(input()).. 2023. 1. 24.
백준 27219 Робинзон Крузо https://www.acmicpc.net/problem/27219 27219번: Робинзон Крузо Выведите запись, которая получится на стене хижины Робинзона на $n$-й день. www.acmicpc.net 1 2 3 4 5 6 7 8 9 def sol(n): answer = 'V' * (n // 5) + 'I' * (n % 5) return answer if __name__ == '__main__': n = int(input()) print(sol(n)) Colored by Color Scripter cs 2023. 1. 16.
백준 10203 Count Vowels https://www.acmicpc.net/problem/10203 10203번: Count Vowels Gru has been trying to teach the minions English (they are born knowing only Minionese, which Lucy can’t stand). He is currently stuck trying to teach them the difference between vowels and consonants, which the minions are always confused about, especia www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 def sol(s): answer = s.count('a') + s.cou.. 2023. 1. 7.
백준 10420 기념일 1 https://www.acmicpc.net/problem/10420 10420번: 기념일 1 세계적으로 유명한 커플 상근이와 나예는 2016년 4월 3일이 사귀기 시작한지 200일이 되는 날이었다. 상근이는 그 날이 200일인줄 몰라서 나예한테 혼났다. 이런 일이 다시는 없도록 하기 위해서 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 from datetime import date, timedelta def sol(n): start = date(2014, 4, 2) answer = start + timedelta(days=n - 1) return answer if __name__ == '__main__': n = int(input()) print(sol(n)) Colo.. 2023. 1. 4.
백준 5220 Error Detection https://www.acmicpc.net/problem/5220 5220번: Error Detection In the midst of a fierce battle, Tony Stark’s suit constantly communicates with JARVIS for technical data. This data as transmitted takes the form of 16-bit integer values. However, due to various atmospheric issues (such as those created by all of that www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 def cal(n): if bin(n.. 2023. 1. 4.
백준 16316 Baby Bites https://www.acmicpc.net/problem/16316 16316번: Baby Bites The first line of input contains an integer n (1 ≤ n ≤ 1 000), the number of bites Arild receives. Then second line contains n space-separated words spoken by Arild, the i’th of which is either a non-negative integer ai (0 ≤ ai ≤ 10 000) or the s www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 def sol(nums): for i in range(1,len(nums)+1): if nums[i-1.. 2023. 1. 4.
백준 6190 Another Cow Number Game https://www.acmicpc.net/problem/6190 6190번: Another Cow Number Game The cows are playing a silly number game again. Bessie is tired of losing and wants you to help her cheat. In this game, a cow supplies a number N (1 2023. 1. 3.