ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

๐Ÿ‘ฉ๐Ÿป‍๐Ÿ’ป ๋ฌธ์ œ

 

2741๋ฒˆ: N ์ฐ๊ธฐ

์ž์—ฐ์ˆ˜ N์ด ์ฃผ์–ด์กŒ์„ ๋•Œ, 1๋ถ€ํ„ฐ N๊นŒ์ง€ ํ•œ ์ค„์— ํ•˜๋‚˜์”ฉ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

www.acmicpc.net


โœ๐Ÿป ํ’€์ด

๐ŸŽจ Go

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var n int

	// use bufio for fast scan
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	fmt.Fscanln(reader, &n)

	for i := 0; i < n; i++ {
		fmt.Fprintln(writer, i+1)
	}
}

๐ŸŽจ Python3

import sys

n = int(sys.stdin.readline())

for i in range(1, n+1):
    print(i)
728x90

'dev > algorithm' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

BOJ / 11021๋ฒˆ / A+B - 7 [Go] [Python3]  (0) 2020.03.25
BOJ / 2742๋ฒˆ / ๊ธฐ์ฐ N [Go] [Python3]  (0) 2020.03.24
BOJ / 15552๋ฒˆ / ๋น ๋ฅธ A+B [Go] [Python3]  (0) 2020.03.22
BOJ / 8393๋ฒˆ / ํ•ฉ [Go] [Python3]  (0) 2020.03.21
BOJ / 10950๋ฒˆ / A+B-3 [Go] [Python3]  (0) 2020.03.20
๋Œ“๊ธ€