문제 링크 7947번: Koncert Dla każdego zestawu danych wypisz trzy liczby całkowite r, g, b stanowiące opis trzech składowych koloru światła padającego na gwiazdę, będące uśrednieniem światła padającego z reflektorów. Podaj wynik uwzględniając zaokrąglenie matematyc www.acmicpc.net 문제 풀이 이 문제는 테스트 케이스마다 10개의 줄이 들어오는데, 각 줄마다 입력되는 세 값을 r, g, b라고 할 때, 10개의 r, g, b 값의 평균을 구해주는 문제이다. 단, 소숫점 첫째자리에서 반올림해준다. 여..
문제 링크 7581번: Cuboids Input is a series of lines, each containing 4 integers, l, w, h and v representing the length, width height and volume of a cuboid in that order. The integers are separated by a single space. 0 < l, w, h
문제 링크 7523번: Gauß 각 테스트 케이스마다 "Scenario #i:"를 출력한 다음, n부터 m까지 모든 정수의 합을 출력한다. 각 테스트 케이스 사이에는 빈 줄을 하나 출력한다. www.acmicpc.net 문제 풀이 1부터 n까지 자연수의 합 공식인 n * (n + 1) // 2를 이용해준다. n, m이 10, 100이라면, 1부터 m 까지의 합은 5050이고, 1부터 n까지의 합은 1부터 10까지이므로 55이다. 그렇다면 10부터 100까지 수의 합은 5050 - 55 + 10이 된다. 이말인즉슨, 1부터 100까지의 합 - 1부터 9까지의 합 => 1부터 m까지의 합 - 1부터 n - 1까지의 합으로 생각할 수 있다. 정답 코드 for i in range(1, int(input()) +..
문제 링크 7510번: 고급 수학 준규는 집을 짓고 있다. 준규는 모든 벽 모양을 직각 삼각형으로 만들려고 한다. 적절히 나무를 잘라 삼각형을 만들었지만, 준규는 각도를 측정할 수 있는 도구를 가지고 있지 않다. 어쩔 수 없 www.acmicpc.net 문제 풀이 테스트 케이스마다 주어지는 3개의 값이 직각삼각형을 만들 수 있는지 여부에 따라 "yes" or "no"를 출력해주면 된다. 정답 코드 for i in range(1, int(input()) + 1) : print(f"Scenario #{i}:") lst = [*map(int, input().split())] if (max(lst) ** 2) == (sum(lst) - min(lst) - max(lst)) ** 2 + min(lst) ** 2 ..
문제 링크 6975번: Deficient, Perfect, and Abundant Write a program that repeatedly reads a positive integer, determines if the integer is deficient, perfect, or abundant, and outputs the number along with its classification. A positive integer, n, is said to be perfect if the sum of its proper diviso www.acmicpc.net 문제 풀이 주어진 입력값을 조건에 따라 출력해준다. 먼저, 입력값으로 자기 자신을 제외한 약수의 리스트를 구해준다. 약수 리스트의 합이 입력값보다 작으면..
문제 링크 6974번: Long Division In days of yore (circa 1965), mechanical calculators performed division by shifting and repeated subtraction. For example, to divide 987654321 by 3456789, the numbers would first be aligned by their leftmost digit (see (1) below), and the divisor subtracte www.acmicpc.net 문제 풀이 이 문제는 몫과 나머지를 구해서 출력하는 문제이다. 파이썬에서는 큰 수 연산을 지원하기 때문에 아주 간단하게 문제를 풀 수 있다. 정답 코드 for _ in rang..
문제 링크 6812번: Good times A mobile cell service provider in Ottawa broadcasts an automated time standard to its mobile users that reflects the local time at the user’s actual location in Canada. This ensures that text messages have a valid local time attached to them. For example www.acmicpc.net 문제 풀이 이 문제는 주어진 입력값으로 각각의 지역 시간대로 변환해 출력해야하는 문제이다. 이 문제에서 주의할 점은 다음과 같다. 입력값은 0부터 2359사이의 수이다. (ex. 0을 ..
문제 링크 6794번: What is n, Daddy? Natalie is learning to count on her fingers. When her Daddy tells her a number n (1 ≤ n ≤ 10), she asks “What is n, Daddy?”, by which she means “How many fingers should I hold up on each hand so that the total is n?” To make matters simple, her www.acmicpc.net 문제 풀이 1 부터 10까지의 수를 두 손으로 표현할 수 있는 방법의 수를 출력해주는 문제이다. 본인은 왼손이 항상 더 큰 수를 가지는 것으로 풀었다. 반복 규칙 (n 일 경우) 왼손이 항상..