Tests
unknown
typescript
a year ago
336 B
4
Indexable
const pathLength = 100;
const daylyIncrease = 50;
const daylyDecrease = 30;
function calcDaysToGoal(goal:number, increase:number, decrease:number) {
const profit = increase-decrease
const days = Math.ceil(goal/profit)
const canOnPreviousDay = (days-1)*profit+decrease>=goal
return canOnPreviousDay? days-1: days
}
// 4Editor is loading...
Leave a Comment