문제 링크 9493번: 길면 기차, 기차는 빨라, 빠른 것은 비행기 한 줄에 테스트 케이스가 하나씩 주어진다. 각 테스트 케이스는 세 개의 정수 M(1 ≤ M ≤ 10,000), A 그리고 B(1 ≤ A < B ≤ 1000)로 이루어져 있다. 정수는 공백으로 구분되어 있다. 마지막 테스트 케이 www.acmicpc.net 문제 풀이 주어진 입력값을 통해 기차가 걸린 시간과 비행기가 걸린 시간의 차를 구해준 뒤, 초 단위로 변경해서 조건대로 출력해주면 된다. 단, 반올림을 해야하는 것에 주의하자. 정답 코드 import sys input = sys.stdin.readline hour_to_sec = 3600 min_to_sec = 60 while True: M, A, B = map(float, input(..
문제 링크 9469번: 폰 노이만 250마일 길이의 철로 양 끝에 두 기차 A와 B가 있다. A는 시속 10마일, B는 시속 15마일로 서로를 향해 출발했다. 두 기차의 출발과 동시에 기차 A 앞에 붙어있던 파리 한 마리가 기차가 충돌할 때 까 www.acmicpc.net 문제 풀이 이 문제의 공식은 [거리 / 두 기차의 속도의 합 * 파리의 속도] 이다. 정답 코드 for i in range(1, int(input()) + 1) : N, D, A, B, F = map(float, input().split()) print(int(N), D / (A + B) * F)
문제 링크 9443번: Arrangement of Contest Little Dmitry and little Petr want to arrange a contest. Their little friends submitted several task proposals and now Dmitry and Petr want to select some of them for the contest. As they are just little boys, they cannot estimate quality of tasks, but the www.acmicpc.net 문제 풀이 이 문제는 set 자료구조를 활용해서 주어지는 입력값의 첫 번째 문자들의 종류를 구해준다. 그 후, A ~ Z 까지 순차적으로 set안에 포함되어있는..
문제 링크 9325번: 얼마? 해빈이는 학교를 다니면서 틈틈히 번 돈으로 자동차를 사려고 한다. 자동차에 여러 가지 옵션을 포함시킬 수 있는데 해빈이는 덧셈과 곱셈을 하지 못하기 때문에 친구 태완이에게 도움을 청했 www.acmicpc.net 문제 풀이 주어지는 입력값을 조건에 따라 계산 후 출력해준다. 정답 코드 for _ in range(int(input())) : s = int(input()) for _ in range(int(input())) : q, p = map(int, input().split()) s += q * p print(s)
문제 링크 9317번: Monitor DPI Each input line will have 3 numbers, the decimal value D, the integer value \(\text{Resolution}_{\text{Horizontal}}\), and the integer value \(\text{Resolution}_{\text{Vertical}}\). An input line of three zeroes will signify end of input www.acmicpc.net 문제 풀이 입력값을 받고, 문제에 나오는 공식을 적용해 출력해주면 된다. 정답 코드 while True : D, RH, RV = map(float, input().split()) if D == RH == RV ==..
문제 링크 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..
문제 링크 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()) + ..