문제 링크 9299번: Math Tutoring For each case, output the line “Case x:” where x is the case number, on a single line. The output polynomial is to be formatted in the same manner as the input: the first value being the highest polynomial, and the successive values being the coefficie www.acmicpc.net 문제 풀이 이 문제는 도함수를 구하는 문제이다. 한 줄씩 입력값이 주어질 때, 그 값들에 차수를 곱해주면 된다. 정답 코드 for i in range(1, int(input()) + ..
문제 링크 9298번: Ant Entrapment For each case output the line “Case x:” where x is the case number, on a single line, followed by the string “Area” and the area of the fence as a floating-point value and then a comma, followed by a space and then “Perimeter” and the perimeter www.acmicpc.net 문제 풀이 주어진 입력값 중 x의 최댓값과 x의 최솟값으로 x의 길이를 구하고, y의 최댓값과 y의 최솟값으로 y의 길이를 구해 사각형의 넓이와 둘레를 출력해준다. 정답 코드 import sys ..
문제 링크 9297번: Reducing Improper Fractions For each case output the line “Case x:” where x is the case number, on a single line, followed by a space, and then proper fraction. Each fraction will be of the form “I N/D”, where I is the integer part, N is the numerator of the fractional part, www.acmicpc.net 문제 풀이 이 문제는 두 수 n, m이 주어졌을 때, n을 m으로 나누었을 때의 몫, 나머지에 따라 출력이 달라져야한다. 정답 코드 for i in range(1, i..
문제 링크 9295번: 주사위 각 테스트 케이스마다 "Case x: "를 출력한 다음, 주사위를 두 번 던져 나온 두 수의 합을 출력한다. 테스트 케이스 번호(x)는 1부터 시작한다. www.acmicpc.net 문제 풀이 테스트케이스마다 주어지는 두 수의 합을 조건에 맞게 출력한다. 정답 코드 for i in range(1, int(input()) + 1) : n, m = map(int, input().split()) print(f"Case {i}: {n + m}")
문제 링크 9288번: More Dice For each case, output the line “Case x:” where x is the case number, on a single line. Then output a list of possible dice-pairs that result in that sum, one on each line. Each dice-pair should be comma-separated and enclosed by parentheses. In each pa www.acmicpc.net 문제 풀이 이 문제는 두 개의 주사위의 합으로 주어진 입력값을 표현할 수 있는 경우의 수를 구하는 문제이다. 두 주사위 중 처음으로 출력될 주사위는 두번째로 출력될 주사위보다 작아야하므로 그..
문제 링크 9286번: Gradabase For each case, output the line “Case x:” where x is the case number, on a single line, followed by a list of integers, each on a new line, between 1 and 6. If the student has graduated from the school, do not print them. www.acmicpc.net 문제 풀이 조건에 따라 입력값을 받고, 입력값 + 1이 1이상 6이하일 경우 출력하는 문제이다. 정답 코드 import sys input = sys.stdin.readline for i in range(1, int(input()) + 1) : pr..
문제 링크 9161번: Sir Bedavere’s Bogus Division Solutions The wise Sir Bedavere often uses non-standard logic, yet achieves positive results. Well, it seems he has been at it again, this time with division. He has determined that canceling the common digit of a numerator and denominator produces the correct answe www.acmicpc.net 문제 풀이 두 세 자리의 수 x, y가 있을 때, x의 일의 자리 수와 y의 백의 자리 수가 같을 경우, 두 수를 제거해서 출력해..
문제 링크 9094번: 수학적 호기심 첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 한 줄로 이루어져 있으며, n과 m이 주어진다. 두 수는 0보다 크고, 100보다 작거나 같다. www.acmicpc.net 문제 풀이 이 문제는 주어진 공식이 정수인 쌍의 갯수를 구하는 문제이다. 주어진 공식을 반복문을 통해 계속 계산하다보면, 계산에 대한 시간이 매우 커져 시간초과가 발생한다. 따라서, a^2+b^2의 값을 미리 계산해놓은 뒤, 테스트케이스가 들어올 때마다 미리 계산된 값에 m을 더해주는 방식으로 계산을 줄일 수 있다. 정답 코드 memory = [[0] * 101 for _ in range(101)] for b in range(2, 101) : for a in range(1, b..