์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ฌธ์ œ/BOJ_Python

[BOJ/Step7] 11720 : ์ˆซ์ž์˜ ํ•ฉ (Python)

NaNaRin๐Ÿ™ƒ 2021. 2. 7. 10:54

www.acmicpc.net/problem/11720

 

11720๋ฒˆ: ์ˆซ์ž์˜ ํ•ฉ

์ฒซ์งธ ์ค„์— ์ˆซ์ž์˜ ๊ฐœ์ˆ˜ N (1 ≤ N ≤ 100)์ด ์ฃผ์–ด์ง„๋‹ค. ๋‘˜์งธ ์ค„์— ์ˆซ์ž N๊ฐœ๊ฐ€ ๊ณต๋ฐฑ์—†์ด ์ฃผ์–ด์ง„๋‹ค.

www.acmicpc.net


๋ฌธ์ œ

N๊ฐœ์˜ ์ˆซ์ž๊ฐ€ ๊ณต๋ฐฑ ์—†์ด ์“ฐ์—ฌ์žˆ๋‹ค. ์ด ์ˆซ์ž๋ฅผ ๋ชจ๋‘ ํ•ฉํ•ด์„œ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

 

์ž…๋ ฅ

์ฒซ์งธ ์ค„์— ์ˆซ์ž์˜ ๊ฐœ์ˆ˜ N (1 ≤ N ≤ 100)์ด ์ฃผ์–ด์ง„๋‹ค. ๋‘˜์งธ ์ค„์— ์ˆซ์ž N๊ฐœ๊ฐ€ ๊ณต๋ฐฑ์—†์ด ์ฃผ์–ด์ง„๋‹ค.

 

์ถœ๋ ฅ

์ž…๋ ฅ์œผ๋กœ ์ฃผ์–ด์ง„ ์ˆซ์ž N๊ฐœ์˜ ํ•ฉ์„ ์ถœ๋ ฅํ•œ๋‹ค.

 

์˜ˆ์ œ ์ž…๋ ฅ 1

1

1

 

์˜ˆ์ œ ์ถœ๋ ฅ 1

1

 

์˜ˆ์ œ ์ž…๋ ฅ 2

5

54321

 

์˜ˆ์ œ ์ถœ๋ ฅ 2

15

 

์˜ˆ์ œ ์ž…๋ ฅ 3

25

7000000000000000000000000

 

์˜ˆ์ œ ์ถœ๋ ฅ 3

7

 

์˜ˆ์ œ ์ž…๋ ฅ 4

11

10987654321

 

์˜ˆ์ œ ์ถœ๋ ฅ 4

46


ํ’€์ด

 

# 11720.py

n = int(input())
num = input()
total = 0

for i in num:
    total += int(i)

print(total)