-
Notifications
You must be signed in to change notification settings - Fork 0
5-sep037 #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
5-sep037 #29
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // | ||
| // main.swift | ||
| // 14501 | ||
| // | ||
| // Created by Seungeun Park on 5/24/25. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| let N = Int(readLine()!)! | ||
| var profitFromWork : [(Int, Int)] = [] | ||
| var maxProfit = 0 | ||
|
|
||
| for _ in 0 ..< N { | ||
| let input = readLine()!.split(separator: " ").map { Int($0)! } | ||
| let (time, profit) = (input[0], input[1]) | ||
| profitFromWork.append((time, profit)) | ||
|
Comment on lines
+16
to
+17
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μ΄λ°μμΌλ‘ λ΄μΌμ ¨κ΅°μ! time, profitμ΄ μ€μ μ½λμμ μ°μ΄μ§μμμ
|
||
| } | ||
|
|
||
| func workTime(day: Int, profit: Int){ | ||
| if day >= N { | ||
| maxProfit = max(maxProfit, profit) | ||
| return | ||
| } | ||
|
|
||
| if day + profitFromWork[day].0 <= N { | ||
| workTime(day: day + profitFromWork[day].0, profit: profit + profitFromWork[day].1) | ||
| } | ||
| workTime(day: day + 1, profit: profit) | ||
| } | ||
|
Comment on lines
+26
to
+30
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μΉ μ¬κ·ν¨μλ₯Ό μ΄μ©ν΄μ μ μ λ³μμ maxλ₯Ό μ¬μ©ν΄μ ꡬννμ ¨λ€μ!!
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μ λ ₯ κ° μ΅λμΉκ° 15λΌμ μννλ©΄ λκ² λ€ μκ°μ νλλ° μ¬κ·λ‘ μ ꡬννμ λ―! |
||
|
|
||
| workTime(day: 0, profit: 0) | ||
| print(maxProfit) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,5 +9,6 @@ | |
| | 2μ°¨μ | 2025.04.10 | DFS | [νΈλ¦¬μ λΆλͺ¨ μ°ΎκΈ°](https://www.acmicpc.net/problem/11725)|https://github.com/AlgoLeadMe/AlgoLeadMe-14/pull/12| | ||
| | 3μ°¨μ | 2025.04.28 | μ λ ¬ | [μ λ―Έμ¬ λ°°μ΄](https://www.acmicpc.net/problem/11656)|https://github.com/AlgoLeadMe/AlgoLeadMe-14/pull/13| | ||
| | 4μ°¨μ | 2025.05.11 | DP | [1, 2, 3 λνκΈ°](https://www.acmicpc.net/problem/9095)|https://github.com/AlgoLeadMe/AlgoLeadMe-14/pull/21| | ||
| | 5μ°¨μ | 2025.05.24 | BruteForce | [ν΄μ¬](https://www.acmicpc.net/problem/14501)|https://github.com/AlgoLeadMe/AlgoLeadMe-14/pull/29| | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dfsλ‘ νμλλ° μ μ¬κΈ° λΈλ£¨νΈν¬μ€λ‘ λ£μμ΄μ λ§μΉ΄λ‘λμ¨ γ γ
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ν μ΄κ² λμΌ
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. κΈ°μ΅ μλ¨ ;; |
||
|
|
||
| --- | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
λ³μλͺ μλ²½ν©λλ€. ^^..
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
γ γ γ γ γ γ γ γ γ γ γ γ γ γ±γ ν©λλ€ ! λ λ©μ§ λ³μλͺ μ§κ³ μΆμλ° μ λ κ² μ§κ΄μ μΈ κ² λ νΈν΄μ μ¬μ€ .