SWEA 1206. [S/W 문제해결 기본] 1일차 - View 파이썬
·
CodingTest
for i in range(1, 11) : N = int(input().strip()) blocks = list(map(int,input().split())) #blocks = [0,0,3,5,2,4,9,0,6,4,0,6,0,0] chomang = 0 for idx in range(2, len(blocks)-2) : left = idx - 2 right = idx + 3 left_side = max(blocks[left:idx]) right_side = max(blocks[idx+1:right]) #우리집이 제일 큰경우 if blocks[idx] > max(left_side, right_side) : chomang += blocks[idx] - max(left_side, right_side) print(..
SWEA 1208. [S/W 문제해결 기본] 1일차 Flatten 파이썬
·
CodingTest
# blocks = [5,8,3,1,5,6,9,9,2,2,4] def dump() : blocks[-1] = blocks[-1] -1 blocks[0] = blocks[0] + 1 if blocks[0] > blocks[1] or blocks[-1] < blocks[-2] : blocks.sort() def find_min_max () : return blocks[-1] -blocks[0]
SWEA 1213. [S/W 문제해결 기본] 3일차 - String 파이썬
·
CodingTest
for t in range(1, 11) : N = int(input().strip()) words = input().strip() lines = input().strip() strs = lines.split(words) print("#" + str(N) + " " + str(len(strs)-1))
SWEA 1234 [S/W 문제해결 기본] 10일차 - 비밀번호
·
CodingTest
for test_case in range(1, 11): stack = [] n, nums = input().split() nums = list(nums.strip()) for num in nums: if not stack: stack.append(num) else: if stack[-1] == num: stack.pop() else: stack.append(num) print('#' + str(test_case), ''.join(stack))
SWEA 14178. 1차원 정원 파이썬
·
CodingTest
import math N = int(input().strip()) for testcase in range(1, N+1) : N, D = map(int,input().split()) D = D*2 + 1 result = N / D result = math.ceil(result) print(f"#{testcase} {result}")
jjongguet
'SWEA' 태그의 글 목록