๐Ÿ’ป/ํ”„๋กœ๊ทธ๋ž˜๋ฐ 30

[ํŒŒ์ด์ฌ] ์—ฌ๋Ÿฌ ์นดํ…Œ๊ณ ๋ฆฌ๋ฅผ ์ผ์ • ํ™•๋ฅ ๋กœ ์ƒ์„ฑ

0๋ถ€ํ„ฐ 1 ์‚ฌ์ด์˜ ๋‚œ์ˆ˜๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค๊ณ , ๋ˆ„์ ํ™•๋ฅ ์„ ํ†ตํ•ด ๊ตฌ์„ฑํ•œ ํ…Œ์ด๋ธ”์— ์–ด๋Š ๊ณณ์— ๋“ค์–ด๊ฐ€๋Š”๊ฐ€๋กœ ํ™•๋ฅ ์  ๋ฐœ์ƒ ๊ฐ€๋Šฅ ์˜ˆ์‹œ # ์‚ฌ๊ณผ, ํฌ๋„, ๋ณต์ˆญ์•„, ๊ทค์„ ์•„๋ž˜์™€ ๊ฐ™์€ ํ™•๋ฅ ๋กœ 100๊ฐœ๋ฅผ ์ƒ์„ฑ # ์‚ฌ๊ณผ 20%, ํฌ๋„ 15%, ๋ณต์ˆญ์•„ 40%, ๊ทค 25% import random FRUIT_NUM = 100 # ๋ˆ„์  ํ™•๋ฅ ์„ ๊ณผ์ผ ์ˆœ์„œ๋Œ€๋กœ ๊ธฐ๋ก FRUIT_PROB = [0.20, 0.35, 0.75, 1.00] FRUIT_DICT = {0: '์‚ฌ๊ณผ', 1: 'ํฌ๋„', 2: '๋ณต์ˆญ์•„', 3: '๊ทค'} fruit_table = [0, 0, 0, 0] n = random.random() for i in range(FRUIT_NUM): for j in range(4): if n < fruit_prob[j]: fruit_tab..

[C, C++] ๊ณต๋ฐฑ์ด ํฌํ•จ๋œ ๋ฌธ์ž์—ด ์ž…๋ ฅ๋ฐ›๊ธฐ

[C++] ๊ณต๋ฐฑ์ด ํฌํ•จ๋œ ๋ฌธ์ž์—ด ์ž…๋ ฅ๋ฐ›๊ธฐ(char array, string : getline) C, C++์—์„œ ์ž…๋ ฅ์„ ๋ฐ›์„ ๋•Œ "๊ณต๋ฐฑ์ด ํฌํ•จ๋œ ๋ฌธ์ž์—ด"์„ ์ž…๋ ฅ๋ฐ›๋Š” ๋ฒ•์„ ์†Œ๊ฐœํ•œ๋‹ค. Code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #include #include using namespace std; int main(){.. shjz.tistory.com ์ฐธ๊ณ  ๋ฌธ์ œ 2908๋ฒˆ: ์ƒ์ˆ˜ ์ƒ๊ทผ์ด์˜ ๋™์ƒ ์ƒ์ˆ˜๋Š” ์ˆ˜ํ•™์„ ์ •๋ง ๋ชปํ•œ๋‹ค. ์ƒ์ˆ˜๋Š” ์ˆซ์ž๋ฅผ ์ฝ๋Š”๋ฐ ๋ฌธ์ œ๊ฐ€ ์žˆ๋‹ค. ์ด๋ ‡๊ฒŒ ์ˆ˜ํ•™์„ ๋ชปํ•˜๋Š” ์ƒ์ˆ˜๋ฅผ ์œ„ํ•ด์„œ ์ƒ๊ทผ์ด๋Š” ์ˆ˜์˜ ํฌ๊ธฐ๋ฅผ ๋น„๊ตํ•˜๋Š” ๋ฌธ์ œ๋ฅผ ๋‚ด์ฃผ์—ˆ๋‹ค. ์ƒ๊ทผ์ด๋Š” ์„ธ ์ž๋ฆฌ ์ˆ˜ ๋‘ www.acmicpc.net #include #include using..

[JAVA] ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์น˜

0. ์šฉ์–ด ์ •๋ฆฌ Java SE(Java Standard Edition) : ๊ธฐ๋ณธ์ ์ธ API๋ฅผ ํฌํ•จํ•˜๊ณ  ์žˆ๋Š”, ํ”ํžˆ ์ƒ๊ฐํ•˜๋Š” Java. JVM(Java Virtual Machine) : Java ํด๋ž˜์Šค๋ฅผ ์ฝ๋Š” ๊ฐ€์ƒ๋จธ์‹ . ํ•ต์‹ฌ ์—”์ง„. JRE(Java Runtime Environment) : Java๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” ํ™˜๊ฒฝ JDK(Java Development Kit) : Java๋ฅผ ๊ฐœ๋ฐœํ•  ์ˆ˜ ์žˆ๋Š” ํ™˜๊ฒฝ 1. Java SE ์„ค์น˜ (๋งํฌ) : ๋ฒ„์ „์€ ๋”ฑํžˆ ์‹ ๊ฒฝ์“ธ ๊ฑฐ ์—†์ด ์ตœ์‹ ๊ฑฐ ๊น”์•„์ฃผ์ž. 2. JRE ์„ค์น˜ (๋งํฌ) : ๋ฒ„์ „์€ ๋”ฑํžˆ ์‹ ๊ฒฝ์“ธ๊ฑฐ ์—†์ด ์ตœ์‹ ๊ฑฐ ๊น”์•„์ฃผ์ž. 3. ํ™˜๊ฒฝ๋ณ€์ˆ˜ ํŽธ์ง‘ ํ™˜๊ฒฝ๋ณ€์ˆ˜๋ฅผ ํŽธ์ง‘ํ•ด์ฃผ์ง€ ์•Š์œผ๋ฉด, ๋‚˜์ค‘์— ์ดํด๋ฆฝ์Šค ์‹คํ–‰ ์‹œ JVM์˜ ๋ฒ„์ „์„ ์ž˜๋ชป ์ธ์‹ํ•œ๋‹ค. ์ž๋ฐ”(JAVA) JDK ์„ค์น˜ ๋ฐ ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ..

[C, C++] scanf์˜ EOF ๋ฐ˜ํ™˜

๋ฌธ์ œ 10951๋ฒˆ: A+B - 4 ๋‘ ์ •์ˆ˜ A์™€ B๋ฅผ ์ž…๋ ฅ๋ฐ›์€ ๋‹ค์Œ, A+B๋ฅผ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. www.acmicpc.net ํ’€์ด #include int main() { int A, B; while (true) { if (scanf("%d %d", &A, &B) == EOF) return 0; printf("%d\n", A + B); } return 0; } ์ž˜๋ณด๋ฉด ๋ฐ˜๋ณต๋ฌธ์˜ ์ข…๋ฃŒ์กฐ๊ฑด์ด ์ฃผ์–ด์ ธ ์žˆ์ง€ ์•Š๋‹ค. ์ด๋Ÿด ๊ฒฝ์šฐ ์–ด์ฐจํ”ผ ๋ฐฑ์ค€์—์„œ ์ฑ„์ ํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ํ…Œ์ŠคํŠธ์ผ€์ด์Šค์—๋„ ๋์ด ์žˆ์„ ๊ฒƒ์ด๋‹ค. scanf ํ•จ์ˆ˜๊ฐ€ ์ž…๋ ฅ ํŒŒ์ผ์˜ ๋์„ ๋งŒ๋‚˜๋ฉด EOF(End Of File)๋ฅผ ๋ฐ˜ํ™˜ํ•จ์„ ์ด์šฉํ•˜์—ฌ ๋ฐ˜๋ณต๋ฌธ์„ ํƒˆ์ถœํ•ด์ฃผ์ž.

[C, C++] cout์˜ ์ถœ๋ ฅ ์†๋„ ๊ฐœ์„ 

๋ฌธ์ œ 15552๋ฒˆ: ๋น ๋ฅธ A+B ์ฒซ ์ค„์— ํ…Œ์ŠคํŠธ์ผ€์ด์Šค์˜ ๊ฐœ์ˆ˜ T๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. T๋Š” ์ตœ๋Œ€ 1,000,000์ด๋‹ค. ๋‹ค์Œ T์ค„์—๋Š” ๊ฐ๊ฐ ๋‘ ์ •์ˆ˜ A์™€ B๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. A์™€ B๋Š” 1 ์ด์ƒ, 1,000 ์ดํ•˜์ด๋‹ค. www.acmicpc.net ํ’€์ด ruhz3/CodingTest To prepare for coding test. Contribute to ruhz3/CodingTest development by creating an account on GitHub. github.com #include using namespace std; int main() { cin.tie(NULL); ios_base::sync_with_stdio(false); int T; cin >> T; int A, B; for (int i = ..

[ํŒŒ์ด์ฌ] f-string, ๋ฌธ์ž์—ด ๊ธธ์ด ๊ณ ์ •

์ฐธ๊ณ  python 3์—์„œ๋Š” f-string์ด ๊ฐ‘์ด๋‹ค. f-string ์‚ฌ์šฉ ๋ฐฉ๋ฒ•๊ณผ ์‚ฌ์šฉํ•ด์•ผ ํ•˜๋Š” ์ด์œ  Python ์—์„œ ๋ฌธ์ž์—ด์„ ๋‹ค๋ฃฐ ๋•Œ๋Š” ์—ฌ๋Ÿฌ๊ฐ€์ง€ ๋ฐฉ์‹์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. ๋Œ€๋ถ€๋ถ„์€ ์•„๋งˆ๋„ ๊ธฐ์กด python 2์—์„œ ์ง€์›ํ•˜๋˜ %-formatting ๋ฐฉ์‹๊ณผ Format string syntax ์ธ str.fo.. bluese05.tistory.com ๊ฐ€๋…์„ฑ์ด ์ข‹๋‹ค ๋ณ€์ˆ˜์˜ type์— ๋Œ€ํ•œ ์ž์œ ๋„๊ฐ€ ๋” ๋†’๋‹ค. ๊ถ๊ธˆํ–ˆ๋˜ ์ฝ”๋“œ username_header = f"{len(username):

[ํŒŒ์ด์ฌ] ๋‹จ์ถ•ํ‚ค ์ •๋ฆฌ

https://kgu0724.tistory.com/95 Pycharm ๋‹จ์ถ•ํ‚ค ์ •๋ฆฌ (ํŽŒ) Editing Ctrl + Space : Basic code completion (the name of any class,method or variable) Ctrl + Shift + Space : Smart code completion (filters the list of methodsand variables by expected type) Ctrl.. kgu0724.tistory.com Ctrl + Alt + T : ๋‹ค์Œ์œผ๋กœ ์ฝ”๋“œ ๊ฐ์‹ธ๊ธฐ… (if..else, try..catch, for,synchronized, etc.) Ctrl + W : ๊ฐ€์žฅ ์•ˆ์ชฝ์˜ ๊ด„ํ˜ธ๋ถ€ํ„ฐ ์„ ํƒ(์ ์  ํ™•์žฅ ๋œ๋‹ค.) Ctrl + Alt + I..

[ํŒŒ์ด์ฌ] ์ฝ”๋“œ์ ‘๊ธฐ(Code Folding)

https://www.jetbrains.com/help/pycharm/2016.1/code-folding.html#using_folding_comments PyCharm 2016.1 Help :: Code Folding Code Folding On this page: Basics You can collapse (fold) code fragments reducing them to a single visible line. In this way, you can hide the details that, at the moment, seem unimportant. If and when necessary, the folded code fragments can be expanded ( www.jetbrains.com ..