1
과 2
를 더한 값이 된다.n
일간 저금된 최종 금액을 반환한다.function totalMoney(n: number): number {
const DAYOFWEEK = 7
let money = 0
for(let i = 0; i < n; i++) {
const weekMoney = Math.floor(i / DAYOFWEEK)
const dayMoney = (i % DAYOFWEEK) + 1
money += (dayMoney + weekMoney)
}
return money
};