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

[BOJ/Step3] 2739 : ๊ตฌ๊ตฌ๋‹จ (Python)

NaNaRin๐Ÿ™ƒ 2021. 2. 1. 20:19

www.acmicpc.net/problem/2739

 

2739๋ฒˆ: ๊ตฌ๊ตฌ๋‹จ

N์„ ์ž…๋ ฅ๋ฐ›์€ ๋’ค, ๊ตฌ๊ตฌ๋‹จ N๋‹จ์„ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ์ถœ๋ ฅ ํ˜•์‹์— ๋งž์ถฐ์„œ ์ถœ๋ ฅํ•˜๋ฉด ๋œ๋‹ค.

www.acmicpc.net


๋ฌธ์ œ

N์„ ์ž…๋ ฅ๋ฐ›์€ ๋’ค, ๊ตฌ๊ตฌ๋‹จ N๋‹จ์„ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ์ถœ๋ ฅ ํ˜•์‹์— ๋งž์ถฐ์„œ ์ถœ๋ ฅํ•˜๋ฉด ๋œ๋‹ค.

 

์ž…๋ ฅ

์ฒซ์งธ ์ค„์— N์ด ์ฃผ์–ด์ง„๋‹ค. N์€ 1๋ณด๋‹ค ํฌ๊ฑฐ๋‚˜ ๊ฐ™๊ณ , 9๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™๋‹ค.

 

์ถœ๋ ฅ

์ถœ๋ ฅํ˜•์‹๊ณผ ๊ฐ™๊ฒŒ N*1๋ถ€ํ„ฐ N*9๊นŒ์ง€ ์ถœ๋ ฅํ•œ๋‹ค.

 

์˜ˆ์ œ ์ž…๋ ฅ 

2

 

์˜ˆ์ œ ์ถœ๋ ฅ 

2 * 1 = 2

2 * 2 = 4

2 * 3 = 6

2 * 4 = 8

2 * 5 = 10

2 * 6 = 12

2 * 7 = 14

2 * 8 = 16

2 * 9 = 18


ํ’€์ด

 

# 2739.py

n = int(input())

for i in range(1, 10):
    print(n, "*", i, "=", n*i)

 

 

 

๋ญ”๊ฐ€ ํ˜๋ช…์ด๋‹ค.. ์ฝ”๋“œ ๊ฐœ์งง์•„...