문제 링크 9310번: Arithmetic and Geometric Sums The input will be given by 2 lines for each data set. The first line will be N, the term to which the sum should be computed. The next line of data is the series of numbers. They will be integers with a space separating each one. The series will be either www.acmicpc.net 문제 풀이 입력값이 등차수열 혹은 등비수열일 경우에 따라 다른 조건으로 계산해준 뒤 출력해준다. 정답 코드 while True : n = int(in..
문제 링크 9306번: Practice: Roll Call For each case, output the line “Case x:” where x is the case number, on a single line. This is followed by the full name entered, using the format “Last, First”. www.acmicpc.net 문제 풀이 입력값을 두 줄씩 받고, 두번째 줄이 먼저 출력될 수 있도록 구현한다. 정답 코드 for i in range(1, int(input()) + 1) : a = input() b = input() print(f"Case {i}: {b}, {a}")
문제 링크 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..