Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- Rest
- RecursionError: maximum recursion depth exceeded while calling a Python object
- Slack
- API
- URI
- mime type
- header
- Instance
- creon login
- WebServer
- stock trading
- Version Control
- The Internet
- pyinstaller
- Web Crawler
- Creon
- Auto Login
- handleMethodsArgumentNotValid
- AESCipher
- python
- mongodb
- KOSDAQ
- spec
- EC2
- AWS
- Daishin Securities
- Stock
- ExceptionHandler
- automated system
- request param
Archives
- Today
- Total
Change the Better World
Greedy Algorithm(1) - Change 본문
- what is the GREEDY ALGORITHM?
https://en.wikipedia.org/wiki/Greedy_algorithm
Greedy algorithm - Wikipedia
From Wikipedia, the free encyclopedia Jump to navigation Jump to search computer science heuristics that makes the locally optimal choice at each stage Greedy algorithms determine the minimum number of coins to give while making change. These are the steps
en.wikipedia.org
Question1. give change to a customer by using greedy algorithm?
₩500, ₩100, ₩50, ₩10
money = int(input())
count = 0
coin_types = [500, 100, 50, 10]
for coin in coin_types:
count += n // coin
n %= coin
return count
'Algorithm' 카테고리의 다른 글
Implement (0) | 2021.11.14 |
---|---|
Greedy Algorithm (2) - law of large numbers (0) | 2021.09.15 |
Comments