Nanarin๐Ÿ™ƒ 278

[JAVA] replace() / replaceFirst() ๋ฉ”์†Œ๋“œ

docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#replace(char,char) String (Java SE 15 & JDK 15) All Implemented Interfaces: Serializable, CharSequence, Comparable , Constable, ConstantDesc public final class String extends Object implements Serializable, Comparable , CharSequence, Constable, ConstantDesc The String class represents character strings. docs.oracle.com do..

[JAVA] StringBuffer ํด๋ž˜์Šค

docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/StringBuffer.html StringBuffer (Java SE 15 & JDK 15) All Implemented Interfaces: Serializable, Appendable, CharSequence, Comparable public final class StringBuffer extends Object implements Serializable, Comparable , CharSequence A thread-safe, mutable sequence of characters. A string buffer is like a String docs.oracle.com java.lang..

[JAVA] StringTokenizer ํด๋ž˜์Šค

docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/StringTokenizer.html StringTokenizer (Java SE 15 & JDK 15) All Implemented Interfaces: Enumeration public class StringTokenizer extends Object implements Enumeration The string tokenizer class allows an application to break a string into tokens. The tokenization method is much simpler than the one used by the Stre docs.oracle.com jav..

[๊ธฐํƒ€] ์•„์Šคํ‚ค ์ฝ”๋“œ (ASCII)

์•„์Šคํ‚ค์ฝ”๋“œ๋ž€? : ASCII stands for the "American Standard Code for Information Interchange". It's a 7-bit character set containing 128 characters. ์ •๋ณด ๊ตํ™˜์„ ์œ„ํ•œ ๋ฏธ๊ตญ ํ‘œ์ค€ ์ฝ”๋“œ. 7๋น„ํŠธ ๋ฌธ์ž ์ง‘ํ•ฉ. www.asciicharstable.com/ ASCII characters table www.asciicharstable.com

[JAVA] format() ๋ฉ”์†Œ๋“œ

docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#format(java.lang.String,java.lang.Object...) String (Java SE 15 & JDK 15) All Implemented Interfaces: Serializable, CharSequence, Comparable , Constable, ConstantDesc public final class String extends Object implements Serializable, Comparable , CharSequence, Constable, ConstantDesc The String class represents character s..

2021-01-14

๋ฐฑ์ค€ ๋ฌธ์ œํ’€์ด๋ฅผ ๋„ˆ๋ฌด ์„ค๋ช…์—†์ด ์ฝ”๋“œ๋งŒ ์ ์—ˆ๋”๋‹ˆ ๋‚˜์ค‘์— ๋ด๋„ ์–ด๋–ป๊ฒŒ ํ’€์—ˆ๋Š”์ง€๋„ ์ž˜ ๋ชจ๋ฅด๊ฒ ๊ณ  ์‚ฌ์šฉํ–ˆ๋˜ ํด๋ž˜์Šค๋‚˜ ๋ฉ”์„œ๋“œ๋„ ๊ธฐ์–ต์ด ์ž˜ ์•ˆ๋‚ฌ๋‹ค. ๊ทธ๋ž˜์„œ ๋Œ€๋Œ€์ ์œผ๋กœ ์ง€๋‚œ ์ฝ”๋“œ๋“ค์— ํ’€์ด๋ฅผ ์ ์–ด๋†“๊ณ  ์‚ฌ์šฉํ•œ ํด๋ž˜์Šค์™€ ๋ฉ”์„œ๋“œ๋„ ์ •๋ฆฌํ•˜๊ธฐ๋กœ ํ–ˆ๋‹ค. ์–ผ๋งˆ ์•ˆํ’€์—ˆ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ๋Š”๋ฐ ์ƒ๊ฐ๋ณด๋‹ค ์ˆซ์ž๊ฐ€ ๋งŽ์•„์„œ ์ข€ ๋‹นํ™ฉ์Šค๋Ÿฝ๋‹ค. ์˜ค๋Š˜ ๋‹ค ๋งˆ๋ฌด๋ฆฌ ํ•˜๊ณ  ๋‚ด์ผ ๋‹ค์‹œ ์ƒˆ๋กœ ๋ฌธ์ œํ’€์ด๋ฅผ ํ•˜๊ณ  ์‹ถ์—ˆ๋Š”๋ฐ ๋‚ด์ผ๊นŒ์ง€ ๋‚จ์€ ๋ฌธ์ œ๋“ค๊ณผ ํด๋ž˜์Šค, ๋ฉ”์„œ๋“œ๋ฅผ ์ •๋ฆฌํ•ด์•ผ ํ•  ๊ฒƒ ๊ฐ™๋‹ค..

[์ž๋ฃŒ๊ตฌ์กฐ] ๋ฐฐ์—ด Array

0. ๋ฐฐ์—ด Array ๋ž€ ? ๋ฐฐ์—ด์€ ๊ฐ™์€ ์ž๋ฃŒํ˜•์˜ ๋ณ€์ˆ˜๋กœ ์ด๋ฃจ์–ด์ง„ ๊ตฌ์„ฑ์š”์†Œ๊ฐ€ ๋ชจ์ธ ๊ฒƒ. 1. ๋ฐฐ์—ด ์„ ์–ธ ๋ฐฐ์—ด์„ ์„ ์–ธํ•˜๋ฉด ๋ฐฐ์—ด ๋ณธ์ฒด์™€ ํ•จ๊ผ ๋ฐฐ์—ด์˜ ๊ตฌ์„ฑ ์š”์†Œ์˜ ๊ฐœ์ˆ˜๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” length๋ผ๋Š” ๋ณ€์ˆ˜๊ฐ€ ๋งŒ๋“ค์–ด์ง„๋‹ค. ๋ฐฐ์—ด a์˜ ๊ฐ ์š”์†Œ์˜ ์ž๋ฃŒํ˜•์€ int์ด๊ณ  ๋ฐฐ์—ด a์˜ ์ž๋ฃŒํ˜•์€ int[5] ์ด๋‹ค. int[] a; // ์ž๋ฃŒํ˜•์ด int์ธ ๋ฐฐ์—ด a ์„ ์–ธ : ํ˜•์‹A // => intํ˜• ๋ฐฐ์—ด์ž„์„ ๋ช…ํ™•ํžˆ ์•Œ๋ ค์ฃผ๊ธฐ ๋•Œ๋ฌธ์— ํ›จ์”ฌ ๋งŽ์ด ์‚ฌ์šฉ๋จ int a[]; // ์ž๋ฃŒํ˜•์ด int์ธ ๋ฐฐ์—ด a ์„ ์–ธ : ํ˜•์‹B a = new int[5] // a๋Š” ๊ธธ์ด๊ฐ€ 5์ธ ๋ฐฐ์—ด์„ ์ฐธ์กฐ int[] a = new int[5]; // ์„ ์–ธ๊ณผ ์ฐธ์กฐ๋ฅผ ํ•œ๋ฒˆ์— int[] a = {1, 2, 3, 4, 5} // ๋ฐฐ์—ด ์ดˆ๊ธฐํ™”, ์ˆœ์„œ๋Œ€๋กœ ๋Œ€์ž…๋จ int[] a..

[JAVA] ๋ฐฐ์—ด ์ƒ์„ฑ์‹œ ๊ฐ ์ž๋ฃŒํ˜•์˜ ์ดˆ๊ธฐ๊ฐ’(๋””ํดํŠธ๊ฐ’/default value)

byte (byte)0 short (short)0 int 0 long 0L float 0.0f double 0.0d char '\u0000' boolean false ์ฐธ์กฐํ˜• ๊ณต๋ฐฑ์ฐธ์กฐ or null โ€ป !!! ๋ฐฐ์—ด ์ƒ์„ฑ์‹œ & ์ธ์Šคํ„ด์Šค ๋ณ€์ˆ˜ & ํด๋ž˜์Šค ๋ณ€์ˆ˜ !!! โ€ป ์ง€์—ญ ๋ณ€์ˆ˜๋Š” ์ดˆ๊ธฐ๊ฐ’์œผ๋กœ ์ดˆ๊ธฐํ™”๋˜์ง€ ์•Š์Œ. ๊ผญ ์ดˆ๊ธฐํ™”๋ฅผ ์‹คํ–‰ํ•ด์•ผํ•œ๋‹ค.

[BOJ/Step7] 1316 : ๊ทธ๋ฃน ๋‹จ์–ด ์ฒด์ปค (JAVA)

www.acmicpc.net/problem/1316 1316๋ฒˆ: ๊ทธ๋ฃน ๋‹จ์–ด ์ฒด์ปค ๊ทธ๋ฃน ๋‹จ์–ด๋ž€ ๋‹จ์–ด์— ์กด์žฌํ•˜๋Š” ๋ชจ๋“  ๋ฌธ์ž์— ๋Œ€ํ•ด์„œ, ๊ฐ ๋ฌธ์ž๊ฐ€ ์—ฐ์†ํ•ด์„œ ๋‚˜ํƒ€๋‚˜๋Š” ๊ฒฝ์šฐ๋งŒ์„ ๋งํ•œ๋‹ค. ์˜ˆ๋ฅผ ๋“ค๋ฉด, ccazzzzbb๋Š” c, a, z, b๊ฐ€ ๋ชจ๋‘ ์—ฐ์†ํ•ด์„œ ๋‚˜ํƒ€๋‚˜๊ณ , kin๋„ k, i, n์ด ์—ฐ์†ํ•ด์„œ ๋‚˜ํƒ€๋‚˜๊ธฐ ๋•Œ www.acmicpc.net ๋ฌธ์ œ ๊ทธ๋ฃน ๋‹จ์–ด๋ž€ ๋‹จ์–ด์— ์กด์žฌํ•˜๋Š” ๋ชจ๋“  ๋ฌธ์ž์— ๋Œ€ํ•ด์„œ, ๊ฐ ๋ฌธ์ž๊ฐ€ ์—ฐ์†ํ•ด์„œ ๋‚˜ํƒ€๋‚˜๋Š” ๊ฒฝ์šฐ๋งŒ์„ ๋งํ•œ๋‹ค. ์˜ˆ๋ฅผ ๋“ค๋ฉด, ccazzzzbb๋Š” c, a, z, b๊ฐ€ ๋ชจ๋‘ ์—ฐ์†ํ•ด์„œ ๋‚˜ํƒ€๋‚˜๊ณ , kin๋„ k, i, n์ด ์—ฐ์†ํ•ด์„œ ๋‚˜ํƒ€๋‚˜๊ธฐ ๋•Œ๋ฌธ์— ๊ทธ๋ฃน ๋‹จ์–ด์ด์ง€๋งŒ, aabbbccb๋Š” b๊ฐ€ ๋–จ์–ด์ ธ์„œ ๋‚˜ํƒ€๋‚˜๊ธฐ ๋•Œ๋ฌธ์— ๊ทธ๋ฃน ๋‹จ์–ด๊ฐ€ ์•„๋‹ˆ๋‹ค. ๋‹จ์–ด N๊ฐœ๋ฅผ ์ž…๋ ฅ์œผ๋กœ ๋ฐ›์•„ ๊ทธ๋ฃน ๋‹จ์–ด์˜ ๊ฐœ์ˆ˜๋ฅผ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ..

[BOJ/Step7]2941 : ํฌ๋กœ์•„ํ‹ฐ์•„ ์•ŒํŒŒ๋ฒณ (JAVA)

www.acmicpc.net/problem/2941 2941๋ฒˆ: ํฌ๋กœ์•„ํ‹ฐ์•„ ์•ŒํŒŒ๋ฒณ ์˜ˆ์ „์—๋Š” ์šด์˜์ฒด์ œ์—์„œ ํฌ๋กœ์•„ํ‹ฐ์•„ ์•ŒํŒŒ๋ฒณ์„ ์ž…๋ ฅํ•  ์ˆ˜๊ฐ€ ์—†์—ˆ๋‹ค. ๋”ฐ๋ผ์„œ, ๋‹ค์Œ๊ณผ ๊ฐ™์ด ํฌ๋กœ์•„ํ‹ฐ์•„ ์•ŒํŒŒ๋ฒณ์„ ๋ณ€๊ฒฝํ•ด์„œ ์ž…๋ ฅํ–ˆ๋‹ค. ํฌ๋กœ์•„ํ‹ฐ์•„ ์•ŒํŒŒ๋ฒณ ๋ณ€๊ฒฝ ฤ c= ฤ‡ c- dลพ dz= ฤ‘ d- lj lj nj nj š s= ลพ z= www.acmicpc.net ๋ฌธ์ œ ์˜ˆ์ „์—๋Š” ์šด์˜์ฒด์ œ์—์„œ ํฌ๋กœ์•„ํ‹ฐ์•„ ์•ŒํŒŒ๋ฒณ์„ ์ž…๋ ฅํ•  ์ˆ˜๊ฐ€ ์—†์—ˆ๋‹ค. ๋”ฐ๋ผ์„œ, ๋‹ค์Œ๊ณผ ๊ฐ™์ด ํฌ๋กœ์•„ํ‹ฐ์•„ ์•ŒํŒŒ๋ฒณ์„ ๋ณ€๊ฒฝํ•ด์„œ ์ž…๋ ฅํ–ˆ๋‹ค. ํฌ๋กœ์•„ํ‹ฐ์•„ ์•ŒํŒŒ๋ฒณ๋ณ€๊ฒฝ ฤ c= ฤ‡ c- dลพ dz= ฤ‘ d- lj lj nj nj š s= ลพ z= ์˜ˆ๋ฅผ ๋“ค์–ด, ljes=njak์€ ํฌ๋กœ์•„ํ‹ฐ์•„ ์•ŒํŒŒ๋ฒณ 6๊ฐœ(lj, e, š, nj, a, k)๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ๋‹ค. ๋‹จ์–ด๊ฐ€ ์ฃผ์–ด์กŒ์„ ๋•Œ, ๋ช‡ ๊ฐœ์˜ ํฌ๋กœ์•„ํ‹ฐ..