본문 바로가기

백준1054

백준 10188 Quadrilateral https://www.acmicpc.net/problem/10188 10188번: Quadrilateral A quadrilateral is a 4-sided figure. For this program, print out a 4 sided figure using the capital letter X. The largest side will be 20, and the smallest side will be 1. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 def sol(x, y): for _ in range(y): print('X'*x) if __name__ == '__main__': n = int(input()) for _ in range(n): x, y = map(in.. 2022. 12. 23.
백준 26592 Triangle Height https://www.acmicpc.net/problem/26592 26592번: Triangle Height The first line will contain a single integer n that indicates the number of lines that follow. Each line will include the area and base length of a triangle with the two values separated by a single space. area base www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 def sol(a, b): answer = 2*a/b return answer if __name__ == '__main__': n = int(inpu.. 2022. 12. 23.
백준 26561 Population https://www.acmicpc.net/problem/26561 26561번: Population The first line of input will contain a single integer n that indicates the number of lines to follow. Each line will consist of two integers, p and t, where p is the beginning population, and t is the amount of time that will pass. Both p and t will be bet www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 def sol(p, t): answer = p - int(t/7) + int(t/4).. 2022. 12. 23.
백준 26736 Wynik meczu https://www.acmicpc.net/problem/26736 26736번: Wynik meczu Drużyny Algogrodu i Bajtocji grają w wielkim finale Mistrzostw Świata w Piłce Ręcznej. Bajtosia, jako analityk sportowy, skrzętnie notuje wszystkie gole. Za każdym razem, kiedy padnie gol dla jednej z drużyn, Bajtosia zapisuje na kartce literkę A www.acmicpc.net 1 2 3 4 5 6 7 def sol(s): print('%d : %d'%(s.count('A'),s.count('B'))) if __n.. 2022. 12. 23.
백준 5358 Football Team https://www.acmicpc.net/problem/5358 5358번: Football Team Print the same list of names with every ‘i’ replaced with an ‘e’, every ‘e’ replaced with an ‘i’, every ‘I’ replaced with an ‘E’, and every ‘E’ replaced with an ‘I’. 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 def sol(s): answer = '' for alphabet in s: if alphabet == 'i': answer+='e' elif alphabet == 'I': a.. 2022. 12. 22.
백준 26332 Buying in Bulk https://www.acmicpc.net/problem/26332 26332번: Buying in Bulk The first input line contains a positive integer, n, indicating the number of customers to check. The customers are on the following n input lines, one customer per line. Each line provides two integers; the first integer c (1 ≤ c ≤ 100) is the number www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 def sol(cnt, price): if cnt>1: return c.. 2022. 12. 22.
백준 26531 Simple Sum https://www.acmicpc.net/problem/26531 26531번: Simple Sum You have hired someone to help you with inventory on the farm. Unfortunately, the new cowhand has very limited math skills, and they are having trouble summing two numbers. Write a program to determine if the cowhand is adding these numbers correctly. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 def sol(s): left,right = s.split('=') if eval(lef.. 2022. 12. 22.
백준 6825 Body Mass Index https://www.acmicpc.net/problem/6825 6825번: Body Mass Index The Body Mass Index (BMI) is one of the calculations used by doctors to assess an adult’s health. The doctor measures the patient’s height (in metres) and weight (in kilograms), then calculates the BMI using the formula BMI = weight/(height × height). www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 def sol(weight, height): bmi = weight.. 2022. 12. 22.
백준 26340 Fold the Paper Nicely https://www.acmicpc.net/problem/26340 26340번: Fold the Paper Nicely Dr. Orooji has a daily calendar (365 pages) on his desk. Every morning, he tears off one page and, as he is reading the notes on the next page, he folds (out of habit) the sheet in his hand. Dr. O noticed that he always folds the sheet (a rectangular paper www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 def sol(num1, n.. 2022. 12. 22.
백준 6887 Squares https://www.acmicpc.net/problem/6887 6887번: Squares Gigi likes to play with squares. She has a collection of equal-sized square tiles. Gigi wants to arrange some or all of her tiles on a table to form a solid square. What is the side length of the largest possible square that Gigi can build? For example, wh www.acmicpc.net 1 2 3 4 5 6 def sol(n): return int(n**(1/2)) if __name__ == '__main__': n.. 2022. 12. 22.
백준 5357 Dedupe https://www.acmicpc.net/problem/5357 5357번: Dedupe Redundancy in this world is pointless. Let’s get rid of all redundancy. For example AAABB is redundant. Why not just use AB? Given a string, remove all consecutive letters that are the same. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 def sol(s): answer = [s[0]] for alphabet in s: if answer[-1] != alphabet: answer.append(alphabet) return ''.jo.. 2022. 12. 22.
백준 26350 Good Coin Denomination https://www.acmicpc.net/problem/26350 26350번: Good Coin Denomination Different countries use different coin denominations. For example, the USA uses 1, 5, 10, and 25. A desirable property of coin denominations is to have each coin at least twice the amount of its previous coin in sorted order. For example, the USA denominat www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 def s.. 2022. 12. 22.