Skip to content

๐ŸŽฒ๋กœ๋˜ ๊ฒŒ์ž„ ๊ตฌํ˜„์„ ๊ด€๋ฆฌํ•˜๋Š” ์ €์žฅ์†Œ

Notifications You must be signed in to change notification settings

WeareSoft/java-lotto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

java-lotto

[Step1] ๋กœ๋˜ - ์ž๋™

๊ธฐ๋Šฅ ์š”๊ตฌ ์‚ฌํ•ญ

  • ๋กœ๋˜ ๊ตฌ์ž… ๊ธˆ์•ก์„ ์ž…๋ ฅํ•˜๋ฉด ๊ตฌ์ž… ๊ธˆ์•ก์— ํ•ด๋‹นํ•˜๋Š” ๋กœ๋˜๋ฅผ ๋ฐœ๊ธ‰ํ•ด์•ผ ํ•œ๋‹ค.
  • ๋กœ๋˜ 1์žฅ์˜ ๊ฐ€๊ฒฉ์€ 1000์›์ด๋‹ค.

ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์š”๊ตฌ ์‚ฌํ•ญ

  • ํ•ต์‹ฌ ๋กœ์ง์„ ๊ตฌํ˜„ํ•˜๋Š” ์ฝ”๋“œ์™€ UI๋ฅผ ๋‹ด๋‹นํ•˜๋Š” ๋กœ์ง์„ ๊ตฌ๋ถ„ํ•œ๋‹ค.
    • UI ๋กœ์ง์„ InputView, ResultView์™€ ๊ฐ™์€ ํด๋ž˜์Šค๋ฅผ ์ถ”๊ฐ€ํ•ด ๋ถ„๋ฆฌํ•œ๋‹ค.

ํžŒํŠธ

  • ๋กœ๋˜ ์ž๋™ ์ƒ์„ฑ์€ Collections.shuffle() ๋ฉ”์†Œ๋“œ ํ™œ์šฉํ•œ๋‹ค.
  • Collections.sort() ๋ฉ”์†Œ๋“œ๋ฅผ ํ™œ์šฉํ•ด ์ •๋ ฌ ๊ฐ€๋Šฅํ•˜๋‹ค.
  • ArrayList์˜ contains() ๋ฉ”์†Œ๋“œ๋ฅผ ํ™œ์šฉํ•˜๋ฉด ์–ด๋–ค ๊ฐ’์ด ์กด์žฌํ•˜๋Š”์ง€ ์œ ๋ฌด๋ฅผ ํŒ๋‹จํ•  ์ˆ˜ ์žˆ๋‹ค.

์ถœ๋ ฅ ๊ฒฐ๊ณผ

๊ตฌ์ž…๊ธˆ์•ก์„ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”.
14000
14๊ฐœ๋ฅผ ๊ตฌ๋งคํ–ˆ์Šต๋‹ˆ๋‹ค.
[8, 21, 23, 41, 42, 43]
[3, 5, 11, 16, 32, 38]
[7, 11, 16, 35, 36, 44]
[1, 8, 11, 31, 41, 42]
[13, 14, 16, 38, 42, 45]
[7, 11, 30, 40, 42, 43]
[2, 13, 22, 32, 38, 45]
[23, 25, 33, 36, 39, 41]
[1, 3, 5, 14, 22, 45]
[5, 9, 38, 41, 43, 44]
[2, 8, 9, 18, 19, 21]
[13, 14, 18, 21, 23, 35]
[17, 21, 29, 37, 42, 45]
[3, 8, 27, 30, 35, 44]

์ง€๋‚œ ์ฃผ ๋‹น์ฒจ ๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”.
1, 2, 3, 4, 5, 6

๋‹น์ฒจ ํ†ต๊ณ„
---------
3๊ฐœ ์ผ์น˜ (5000์›)- 1๊ฐœ
4๊ฐœ ์ผ์น˜ (50000์›)- 0๊ฐœ
5๊ฐœ ์ผ์น˜ (1500000์›)- 0๊ฐœ
6๊ฐœ ์ผ์น˜ (2000000000์›)- 0๊ฐœ
์ด ์ˆ˜์ต๋ฅ ์€ 35.7%์ž…๋‹ˆ๋‹ค.

[Step2] ๋กœ๋˜ - 2๋“ฑ

๊ธฐ๋Šฅ ์š”๊ตฌ ์‚ฌํ•ญ

  • 2๋“ฑ์„ ์œ„ํ•ด ์ถ”๊ฐ€ ๋ฒˆํ˜ธ๋ฅผ ํ•˜๋‚˜ ๋” ์ถ”์ฒจํ•œ๋‹ค.
  • ๋‹น์ฒจ ํ†ต๊ณ„์— 2๋“ฑ๋„ ์ถ”๊ฐ€ํ•ด์•ผ ํ•œ๋‹ค.

ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์š”๊ตฌ ์‚ฌํ•ญ

  • ์˜ˆ์™ธ ์ฒ˜๋ฆฌ๋ฅผ ํ†ตํ•ด ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋„๋ก ํ•œ๋‹ค.
  • ๋ชจ๋“  ์›์‹œ๊ฐ’๊ณผ ๋ฌธ์ž์—ด์„ ํฌ์žฅํ•œ๋‹ค.
  • ์ค„์—ฌ์“ฐ์ง€ ์•Š๋Š”๋‹ค.(์ถ•์•ฝ ๊ธˆ์ง€)
  • ์ผ๊ธ‰ ์ฝœ๋ ‰์…˜์„ ์“ด๋‹ค.

์ถœ๋ ฅ ๊ฒฐ๊ณผ

๊ตฌ์ž…๊ธˆ์•ก์„ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”.
14000
14๊ฐœ๋ฅผ ๊ตฌ๋งคํ–ˆ์Šต๋‹ˆ๋‹ค.
[8, 21, 23, 41, 42, 43]
[3, 5, 11, 16, 32, 38]
[7, 11, 16, 35, 36, 44]
[1, 8, 11, 31, 41, 42]
[13, 14, 16, 38, 42, 45]
[7, 11, 30, 40, 42, 43]
[2, 13, 22, 32, 38, 45]
[23, 25, 33, 36, 39, 41]
[1, 3, 5, 14, 22, 45]
[5, 9, 38, 41, 43, 44]
[2, 8, 9, 18, 19, 21]
[13, 14, 18, 21, 23, 35]
[17, 21, 29, 37, 42, 45]
[3, 8, 27, 30, 35, 44]

์ง€๋‚œ ์ฃผ ๋‹น์ฒจ ๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”.
1, 2, 3, 4, 5, 6
๋ณด๋„ˆ์Šค ๋ณผ์„ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”.
7

๋‹น์ฒจ ํ†ต๊ณ„
---------
3๊ฐœ ์ผ์น˜ (5000์›)- 1๊ฐœ
4๊ฐœ ์ผ์น˜ (50000์›)- 0๊ฐœ
5๊ฐœ ์ผ์น˜ (1500000์›)- 0๊ฐœ
5๊ฐœ ์ผ์น˜, ๋ณด๋„ˆ์Šค ๋ณผ ์ผ์น˜(30000000์›) - 0๊ฐœ
6๊ฐœ ์ผ์น˜ (2000000000์›)- 0๊ฐœ
์ด ์ˆ˜์ต๋ฅ ์€ 35.7%์ž…๋‹ˆ๋‹ค.

[Step3] ๋กœ๋˜ - ์ˆ˜๋™

๊ธฐ๋Šฅ ์š”๊ตฌ ์‚ฌํ•ญ

  • ํ˜„์žฌ ๋กœ๋˜ ์ƒ์„ฑ๊ธฐ๋Š” ์ž๋™ ์ƒ์„ฑ ๊ธฐ๋Šฅ๋งŒ ์ œ๊ณตํ•œ๋‹ค. ์‚ฌ์šฉ์ž๊ฐ€ ์ˆ˜๋™์œผ๋กœ ์ถ”์ฒจ ๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์•ผ ํ•œ๋‹ค.
  • ์ž…๋ ฅํ•œ ๊ธˆ์•ก, ์ž๋™ ์ƒ์„ฑ ์ˆซ์ž, ์ˆ˜๋™ ์ƒ์„ฑ ๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜๋„๋ก ํ•ด์•ผ ํ•œ๋‹ค.

์ถœ๋ ฅ ๊ฒฐ๊ณผ

๊ตฌ์ž…๊ธˆ์•ก์„ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”.
14000

์ˆ˜๋™์œผ๋กœ ๊ตฌ๋งคํ•  ๋กœ๋˜ ์ˆ˜๋ฅผ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”.
3

์ˆ˜๋™์œผ๋กœ ๊ตฌ๋งคํ•  ๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”.
8, 21, 23, 41, 42, 43
3, 5, 11, 16, 32, 38
7, 11, 16, 35, 36, 44

์ˆ˜๋™์œผ๋กœ 3์žฅ, ์ž๋™์œผ๋กœ 11๊ฐœ๋ฅผ ๊ตฌ๋งคํ–ˆ์Šต๋‹ˆ๋‹ค.
[8, 21, 23, 41, 42, 43]
[3, 5, 11, 16, 32, 38]
[7, 11, 16, 35, 36, 44]
[1, 8, 11, 31, 41, 42]
[13, 14, 16, 38, 42, 45]
[7, 11, 30, 40, 42, 43]
[2, 13, 22, 32, 38, 45]
[23, 25, 33, 36, 39, 41]
[1, 3, 5, 14, 22, 45]
[5, 9, 38, 41, 43, 44]
[2, 8, 9, 18, 19, 21]
[13, 14, 18, 21, 23, 35]
[17, 21, 29, 37, 42, 45]
[3, 8, 27, 30, 35, 44]

์ง€๋‚œ ์ฃผ ๋‹น์ฒจ ๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”.
1, 2, 3, 4, 5, 6
๋ณด๋„ˆ์Šค ๋ณผ์„ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”.
7

๋‹น์ฒจ ํ†ต๊ณ„
---------
3๊ฐœ ์ผ์น˜ (5000์›)- 1๊ฐœ
4๊ฐœ ์ผ์น˜ (50000์›)- 0๊ฐœ
5๊ฐœ ์ผ์น˜ (1500000์›)- 0๊ฐœ
5๊ฐœ ์ผ์น˜, ๋ณด๋„ˆ์Šค ๋ณผ ์ผ์น˜(30000000์›) - 0๊ฐœ
6๊ฐœ ์ผ์น˜ (2000000000์›)- 0๊ฐœ
์ด ์ˆ˜์ต๋ฅ ์€ 35.7%์ž…๋‹ˆ๋‹ค.

About

๐ŸŽฒ๋กœ๋˜ ๊ฒŒ์ž„ ๊ตฌํ˜„์„ ๊ด€๋ฆฌํ•˜๋Š” ์ €์žฅ์†Œ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published