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

[BOJ/Step3] 2741 : ๊ธฐ์ฐ N (JAVA)

NaNaRin๐Ÿ™ƒ 2021. 1. 7. 20:59

www.acmicpc.net/problem/2742

 

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

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

www.acmicpc.net


๋ฌธ์ œ

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

 

์ž…๋ ฅ

์ฒซ์งธ ์ค„์— 100,000๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์€ ์ž์—ฐ์ˆ˜ N์ด ์ฃผ์–ด์ง„๋‹ค.

 

์ถœ๋ ฅ

์ฒซ์งธ ์ค„๋ถ€ํ„ฐ N๋ฒˆ์งธ ์ค„ ๊นŒ์ง€ ์ฐจ๋ก€๋Œ€๋กœ ์ถœ๋ ฅํ•œ๋‹ค.

 

์˜ˆ์ œ ์ž…๋ ฅ

5

 

์˜ˆ์ œ ์ถœ๋ ฅ

5

4

3

2

1


ํ’€์ด

 

import java.io.*;

public class B2742 {

	public static void main(String[] args) throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		int n = Integer.parseInt(br.readLine());
		
		for(int i = n; i > 0 ; i--) {
			bw.write((i) + "\n");
		}
		
		bw.flush();
		bw.close();

	}

}