사칙연산

Algorithm/PS

[BOJ/백준] 9366 - 삼각형 분류 [python]

문제 링크 9366번: 삼각형 분류 입력의 첫 줄에는 테스트케이스의 개수 T(1

Algorithm/PS

[BOJ/백준] 9325 - 얼마? [python]

문제 링크 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)

Algorithm/PS

[BOJ/백준] 9317 - Monitor DPI [python]

문제 링크 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 ==..

Algorithm/PS

[BOJ/백준] 9310 - Arithmetic and Geometric Sums [python]

문제 링크 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..

Algorithm/PS

[BOJ/백준] 9297 - Reducing Improper Fractions [python]

문제 링크 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..

Algorithm/PS

[BOJ/백준] 9295 - 주사위 [python]

문제 링크 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}")

Algorithm/PS

[BOJ/백준] 9161 - Sir Bedavere’s Bogus Division Solutions [python]

문제 링크 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의 백의 자리 수가 같을 경우, 두 수를 제거해서 출력해..

Algorithm/PS

[BOJ/백준] 9085 - 더하기 [python]

문제 링크 9085번: 더하기 입력의 첫 줄에는 테스트 케이스의 개수 T(1 ≤ T ≤ 10)가 주어진다. 각 테스트 케이스는 첫 줄에 자연수의 개수 N(1 ≤ N ≤ 100)이 주어지고, 그 다음 줄에는 N개의 자연수가 주어진다. 각각의 자연 www.acmicpc.net 문제 풀이 테스트 케이스 별 주어지는 숫자열의 합을 출력해준다. 정답 코드 for _ in range(int(input())) : input() print(sum([*map(int, input().split())]))

chanwoong1
'사칙연산' 태그의 글 목록 (3 Page)