[๋ฐฑ์ค€] ATM / ์ˆ˜ ์ •๋ ฌํ•˜๊ธฐ / ํŒŒ์ด์ฌ / Python / ์ •๋ ฌ
Algorithm/Baekjoon

[๋ฐฑ์ค€] ATM / ์ˆ˜ ์ •๋ ฌํ•˜๊ธฐ / ํŒŒ์ด์ฌ / Python / ์ •๋ ฌ

728x90
๋ฐ˜์‘ํ˜•

 

๐Ÿ’กsolutions )

๐Ÿ’ฌ sorted()๋ฅผ ์ด์šฉํ•ด ์˜ค๋ฆ„์ฐจ์ˆœ ์ •๋ฆฌํ•œ ์ •๋ ฌ์˜ ๊ธฐ๋ณธ ๋ฌธ์ œ

 

๐ŸŽซcode )

# 11399๋ฒˆ ATM ๋ฌธ์ œ

n = int(input())
arr = sorted((map(int, input().split())))
res = 0
next = 0
for i in arr:
    res += i + next
    next += i
print(res)
# 2750๋ฒˆ ์ˆ˜ ์ •๋ ฌํ•˜๊ธฐ ๋ฌธ์ œ

import sys

input = sys.stdin.readline
arr = []

for i in range(int(input())):
    n = int(input())
    arr.append(n)

arr = sorted(arr)

for i in arr:
    print(i)

 

๐Ÿ“Œ description )

๋ฌธ์ œ์ถœ์ฒ˜ : www.acmicpc.net/problem/11399

 

11399๋ฒˆ: ATM

์ฒซ์งธ ์ค„์— ์‚ฌ๋žŒ์˜ ์ˆ˜ N(1 ≤ N ≤ 1,000)์ด ์ฃผ์–ด์ง„๋‹ค. ๋‘˜์งธ ์ค„์—๋Š” ๊ฐ ์‚ฌ๋žŒ์ด ๋ˆ์„ ์ธ์ถœํ•˜๋Š”๋ฐ ๊ฑธ๋ฆฌ๋Š” ์‹œ๊ฐ„ Pi๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. (1 ≤ Pi ≤ 1,000)

www.acmicpc.net

๋ฌธ์ œ์ถœ์ฒ˜ : www.acmicpc.net/problem/11399www.acmicpc.net/problem/2750

 

2750๋ฒˆ: ์ˆ˜ ์ •๋ ฌํ•˜๊ธฐ

์ฒซ์งธ ์ค„์— ์ˆ˜์˜ ๊ฐœ์ˆ˜ N(1 ≤ N ≤ 1,000)์ด ์ฃผ์–ด์ง„๋‹ค. ๋‘˜์งธ ์ค„๋ถ€ํ„ฐ N๊ฐœ์˜ ์ค„์—๋Š” ์ˆซ์ž๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ์ด ์ˆ˜๋Š” ์ ˆ๋Œ“๊ฐ’์ด 1,000๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์€ ์ •์ˆ˜์ด๋‹ค. ์ˆ˜๋Š” ์ค‘๋ณต๋˜์ง€ ์•Š๋Š”๋‹ค.

www.acmicpc.net

 

 

๋ฐ˜์‘ํ˜•