Skip to content

Commit

Permalink
Merge pull request #109 from AlgoLeadMe/29-Dolchae
Browse files Browse the repository at this point in the history
29-Dolchae
  • Loading branch information
Dolchae authored Feb 22, 2024
2 parents 99a4f42 + 3b4f3f8 commit 4825a0e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Dolchae/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@
| 25μ°¨μ‹œ| 2024.02.01 | DP | [1535 μ•ˆλ…•](https://www.acmicpc.net/problem/1535) | [#89](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/89) |
| 26μ°¨μ‹œ| 2024.02.05 | κ΅¬ν˜„ | [18110 solved.ac](https://www.acmicpc.net/problem/18110) | [#93](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/93) |
| 27μ°¨μ‹œ| 2024.02.08 | μ •λ ¬ | [1302 λ² μŠ€νŠΈμ…€λŸ¬](https://www.acmicpc.net/problem/1302) | [#97](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/97) |
| 27μ°¨μ‹œ| 2024.02.15 | 이진 탐색 | [6236 용돈 관리](https://www.acmicpc.net/problem/1302) | [#107](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/107) |
| 28μ°¨μ‹œ| 2024.02.15 | 이진 탐색 | [6236 용돈 관리](https://www.acmicpc.net/problem/1302) | [#107](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/107) |
| 29μ°¨μ‹œ| 2024.02.15 | 브루트포슀 | [2961 λ„μ˜μ΄κ°€ λ§Œλ“  λ§›μžˆλŠ” μŒμ‹](https://www.acmicpc.net/problem/2961) | [#109](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/109) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import sys
from itertools import combinations
input = sys.stdin.readline

n = int(input())

ingrid = [[0 for _ in range(2)] for _ in range(n)]
for i in range(n):
ingrid[i][0],ingrid[i][1] = map(int,input().split())

ans = abs(ingrid[0][0] - ingrid[0][1])
for i in range(1,n+1): #1
for comb in combinations(ingrid,i): #2
print(comb)
sour, bitter = 1,0
for j in range(i): #3
sour *= comb[j][0]
bitter += comb[j][1]
now_diff = abs(sour-bitter)
if now_diff < ans:
ans = now_diff

print(ans)

0 comments on commit 4825a0e

Please sign in to comment.