Skip to content

Commit

Permalink
James Trial
Browse files Browse the repository at this point in the history
  • Loading branch information
natebwangsut committed Feb 20, 2020
1 parent 6cea896 commit 8d8408d
Show file tree
Hide file tree
Showing 6 changed files with 80,194 additions and 81,988 deletions.
4 changes: 2 additions & 2 deletions online-qualification/go/common/library.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ func (l Library) CalcScore(remainingDays uint32, signUpCost float32) float32 {
for _, book := range l.Books {
}*/

completeionCost := (l.SignUp - )
completeionCost := (float32(l.SignUp) + float32(canTake/l.Ship))

availBooks := l.Books[:canTake]
for _, book := range availBooks {
scores += float32(book.Score)
// print(scores)
}
return scores/float32(l.SignUp) - float32(l.SignUp)
return scores / completeionCost
}
return -1
}
6 changes: 3 additions & 3 deletions online-qualification/go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ func doIt(filename string, out io.Writer) uint32 {
}

// debug print score
rd := numDays
rd := int(numDays)
score := uint32(0)
for i := range solLib {
lib := &solLib[i]
canTake := int(lib.Ship * (rd - lib.SignUp))
canTake := int(lib.Ship * uint32(rd-int(lib.SignUp)))
if canTake > len(lib.Books) {
canTake = len(lib.Books)
}
Expand All @@ -196,7 +196,7 @@ func doIt(filename string, out io.Writer) uint32 {
score += booksBackup[tb.ID].Score
booksBackup[tb.ID].Score = 0
}
rd -= lib.SignUp
rd -= int(lib.SignUp)
if rd <= 0 {
break
}
Expand Down
Loading

0 comments on commit 8d8408d

Please sign in to comment.