[코드트리 자리 마다 숫자를 정하는 완전탐색] 개발팀의 능력 python
# ability_list 입력 ability_list = list(map(int, input().split())) # 함수들 # all_diff(a, b, c) def all_diff(a, b, c): # team_1, team_2 team_1, team_2 = ability_list[a] + ability_list[b], ability_list[c] # team_3 team_3 = sum(ability_list) - team_1 - team_2 # 서로 다른지 반환 return team_1 != team_2 and team_2 != team_3 and team_1 != team_3 # calc(a, b, c) def calc(a, b, c): # team_1, team_2 team_1, team_2 ..
2022. 12. 14.
[코드트리 자리 마다 숫자를 정하는 완전탐색] 개발자의 능력 2 python
파이썬 사용자는 참 축복받은 ㅋㅋㅋㅋ max, min 이런거 만들어주셔서 감사합니다. # ability_list 입력 ability_list = list(map(int, input().split())) # 함수들 # calc(a, b, c, d) def calc(a, b, c, d): # sum_1 sum_1 = ability_list[a] + ability_list[b] # sum_2 sum_2 = ability_list[c] + ability_list[d] # sum_3 sum_3 = sum(ability_list) - sum_1 - sum_2 # 반환 return max(sum_1, sum_2, sum_3) - min(sum_1, sum_2, sum_3) # 설계 # min_diff import s..
2022. 12. 13.
[코드트리 자리 마다 숫자를 정하는 완전탐색] 숫자 카운트 python
숫자야구를 파이썬으로 만들어볼줄이야,, 처음엔 당황했지만, 조건 하나씩 필터링해가며 비교해보면 될 듯 해서 만들어봤더니 돌아갔다. # n 입력 n = int(input()) # conditions conditions = [] # conditions 입력 for _ in range(n): num, cnt_1, cnt_2 = input().split() # 형 변환 cnt_1, cnt_2 = int(cnt_1), int(cnt_2) conditions.append([num, cnt_1, cnt_2]) # 함수들 # cnt_2_is_ok(k, correct_cnt, a, b, c) def cnt_2_is_ok(k, correct_cnt, a, b, c): # curr_cnt curr_cnt = 0 # k 분해..
2022. 12. 12.
[코드트리 자리 마다 숫자를 정하는 완전탐색] 두 가지로 열리는 자물쇠 python
원형에서 조건 따질때, 절댓값으로 해결하면 편하다는것을 기억하도록 하자는 교훈,,, # n 입력 n = int(input()) # comb_1 입력 comb_1 = list(map(int, input().split())) # comb_2 입력 comb_2 = list(map(int, input().split())) # 함수들 # open_with_comb_1(a, b, c) def open_with_comb_1(a, b, c): # a, b, c와 comb_1[0], comb_1[1], comb_1[2] 각각의 간격이 모두 2 이내이면 통과 return (abs(comb_1[0] - a) = n-2) and \ (abs(comb_1[1] - b) = n-2) and \ (abs(comb_1[2] - c)..
2022. 12. 12.
[코드트리 구간 단위로 완전탐색] 바구니 안의 사탕 2 python
문제에서 말하는게 너무 애매하다. 1. 바구니가 여러 개 들어갈 수 있다는 것이 동일선상의 여러 개 중 가장 큰 하나를 선택해야 한다는 것인지, 하나의 바구니로 합쳐진다는 것인지 알 수 없었다. 2. 앞 뒤 시작점이 모두 범위 내에 들어야 하는지 아닌지 명확하지 않다. # n, k 입력 n, k = map(int, input().split()) # linear linear = [0] * 401 # candy, pos 입력 for _ in range(n): candy, pos = map(int, input().split()) # linear에 추가 linear[pos] += candy # 함수들 # in_range(s, e) def in_range(s, e): # s가 양수이고, e가 400 이하면 통과 ..
2022. 12. 8.
[코드트리 자리 수 단위로 완전탐색] 숨은 단어 찾기 2 python
# n, m 입력 n, m = map(int, input().split()) # grid 입력 grid = [ input() for _ in range(n) ] # 함수들 # l_to_r(x, y) def l_to_r(x, y): # 범위 내에 있고, 오른쪽 두 개가 'E'면 성공 return y = 2 and grid[x][y-1] == 'E' and grid[x][y-2] == 'E' # u_to_d(x, y) def u_to_d(x, y): # 범위 내에 있고, 아래 두 개가 'E'면 성공 return x = 2 and grid[x-1][y] == 'E' and grid[x-2][y] == 'E' # ru_to_ld(x, y) def ru_to_ld(x, y): # 범위 내에 있고, 왼쪽 대각선 아..
2022. 12. 3.