Skip to content

Commit 0cce367

Browse files
권태형TaeHyoungKwon
authored andcommitted
221104
1 parent a2d003e commit 0cce367

4 files changed

Lines changed: 55 additions & 0 deletions

File tree

kata_2022/backjoon/브루트포스/__init__.py

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
def solution():
2+
number = int(input())
3+
4+
min_constructor = number
5+
for candidate_constructor in range(number)[::-1]:
6+
result = candidate_constructor + sum(int(digit) for digit in str(candidate_constructor))
7+
if result == number:
8+
min_constructor = candidate_constructor
9+
10+
if min_constructor == number:
11+
return 0
12+
13+
return min_constructor
14+
15+
16+
if __name__ == "__main__":
17+
print(solution())
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from itertools import combinations
2+
3+
4+
def solution():
5+
_, dealer_card_number = map(int, input().split())
6+
my_card_numbers = [int(number) for number in input().split()]
7+
8+
approximate_value = 0
9+
for case in combinations(my_card_numbers, 3):
10+
sum_of_card_numbers = sum(case)
11+
if sum_of_card_numbers > dealer_card_number:
12+
continue
13+
14+
if sum_of_card_numbers > approximate_value:
15+
approximate_value = sum_of_card_numbers
16+
17+
return approximate_value
18+
19+
20+
if __name__ == "__main__":
21+
print(solution())
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
def solution():
2+
cases_count = int(input())
3+
people_size_info_list = [list(map(int, input().split())) for _ in range(cases_count)]
4+
5+
ranking_table = {}
6+
for index, people_size_info in enumerate(people_size_info_list):
7+
ranking_table[index] = 1
8+
weight, height = people_size_info
9+
for target_people_size_info in people_size_info_list:
10+
target_weight, target_height = target_people_size_info
11+
if target_weight > weight and target_height > height:
12+
ranking_table[index] += 1
13+
return " ".join(str(rank) for rank in ranking_table.values())
14+
15+
16+
if __name__ == "__main__":
17+
print(solution())

0 commit comments

Comments
 (0)