PS/BaekJoon

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.Queue; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); try { int N = Integer.parseInt(bf.readLine()); Queue queue = new LinkedList(); Stri..
ํ•™๊ต 1์ฃผ์ฐจ ์ˆ˜์—…์‹œ๊ฐ„์—์„œ ๋ฐฐ์› ๋˜ recursion์— ๊ด€ํ•œ ๊ธฐ๋ณธ์ ์ธ ๋ฌธ์ œ์ด๋‹ค. while๋ฌธ์„ ์‚ฌ์šฉํ•ด์„œ ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์ง€๋งŒ, ์žฌ๊ท€๋ฅผ ๋ณต์Šตํ•˜๊ธฐ ์œ„ํ•ด์„œ recursion์„ ์‚ฌ์šฉํ•ด์„œ ๋ฌธ์ œ๋ฅผ ํ’€์–ด๋ณธ๋‹ค. ์ตœ๋Œ€ ๊ณต์•ฝ์ˆ˜ : ๋‘ ์ž์—ฐ์ˆ˜์˜ ์ตœ๋Œ€์˜ ์•ฝ์ˆ˜, ๋‚˜๋ˆˆ ์ˆ˜ ์ค‘์—์„œ ๋‘ ์ˆ˜๊ฐ€ ๊ณตํ†ต์œผ๋กœ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ์ตœ๋Œ€์˜ ๊ณตํ†ต ์ž์—ฐ์ˆ˜๋ฅผ ์ผ์ปซ๋Š”๋‹ค. ์ตœ์†Œ๊ณต๋ฐฐ์ˆ˜ : ๋‘ ์ž์—ฐ์ˆ˜์˜ ์ตœ์†Œ์˜ ๋ฐฐ์ˆ˜, ๋‘ ์ˆ˜์˜ ๋ฐฐ์ˆ˜ ์ค‘์—์„œ ๊ณตํ†ต์ ์ด๋ฉด์„œ ์ตœ์†Œ์˜ ์ž์—ฐ์ˆ˜๋ฅผ ์ผ์ปซ๋Š”๋‹ค. ์ตœ์†Œ ๊ณต๋ฐฐ์ˆ˜๋Š” ๋‘ ์ˆ˜๋ฅผ ๊ณฑํ•œ ๊ฒƒ ์ค‘์—์„œ ์ตœ๋Œ€ ๊ณต์•ฝ์ˆ˜๋ฅผ ๋‚˜๋ˆ„๋ฉด ๊ฐ’์ด ๋‚˜์˜จ๋‹ค. ๊ทธ๋ ‡๋‹ค๋ฉด ์ด ๋ฌธ์ œ์—์„œ ์ค‘์š”ํ•œ ๊ฒƒ์€ ์ตœ๋Œ€ ๊ณต์•ฝ์ˆ˜๋ฅผ ๊ตฌํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ์ตœ๋Œ€ ๊ณต์•ฝ์ˆ˜๋Š” ๋‘ ์ˆ˜๋ฅผ ๋‚˜๋ˆˆ ๋‚˜๋จธ์ง€๋ฅผ ๋‚˜๋ˆˆ ๋‚˜๋จธ์ง€๋ฅผ ๋‚˜๋ˆˆ ๋‚˜๋จธ์ง€์™€ ๊ฐ™์€ ํ˜•์‹์œผ๋กœ ๋‚˜๋ˆ„๋Š” ๊ฐ’์ด 0์ด ๋˜๊ธฐ ์ด์ „๊นŒ์ง€ ๊ณ„์‚ฐํ•˜์—ฌ ๊ทธ ๋•Œ์˜ ๋ชซ์„ ์ตœ๋Œ€ ๊ณต์•ฝ์ˆ˜๋กœ..
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int a; try { a = Integer.parseInt(buff..
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); char[] x = scanner.nextLine().toCharArray(); scanner.close(); Arrays.sort(x); for(int j = x.length-1; j>=0 ; j--) { System.out.print(x[j]); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) { BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); try { int a = Integer.parseInt(buffer.readLine()); int[] array = new int[a]; for(int i = 0 ; i< a ; i..
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); StringBuilder sb = new StringBuilder(); // String ๊ณผ ๋ฌธ์ž์—ด์„ ๋”ํ•  ๋•Œ ์ƒˆ๋กœ์šด ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹Œ, ๊ธฐ์กด์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋”ํ•˜๋Š” ๋ฐฉ์‹ // ์†๋„๊ฐ€ ๋น ๋ฅด๋ฉฐ, ์ƒ๋Œ€์ ์œผ๋กœ ๋ถ€ํ•˜๊ฐ€ ์ ์œผ๋ฏ€๋กœ ๊ธด ๋ฌธ์ž์—ด์„ ๋”ํ•˜๋Š” ์ƒํ™ฉ์—์„œ ์‚ฌ์šฉ // StringBuffer: ๊ณตํ†ต ๋ฉ”์†Œ๋“œ ๋™๊ธฐํ™” ๋ฉ€ํ‹ฐ ์Šค๋ ˆ๋“œ ํ™˜๊ฒฝ์—์„œ๋งŒ // StringBuilder: ๊ทธ์™ธ์˜ ๊ธฐ๋Šฅ์€ ..
import java.util.Scanner; public class _2675 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); int[] r = new int[t]; String[] s = new String[t]; if(t>=1 && t
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); int[] output = new int[t]; for(int i = 0; i 0&&a0&&b
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int input = 0; int[] a = new int [10]; for(int i = 0; i
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); scanner.close(); for(int i = 1; i0 ; j--) { if(i
chaerlo127
'PS/BaekJoon' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (3 Page)