---
# System prepended metadata

title: j180. 戰備存糧 (Food)

---

# j180. 戰備存糧 (Food)
## 題目連結:[j180](https://zerojudge.tw/ShowProblem?problemid=j180)
## 解題想法
* 因為要連續輸入，所以用while True
* 每天判斷的步驟如下
    1. 天數+1
    2. 扣食物並判斷是否還有食物
    3. 判斷是否有空的倉庫可以讓保全離開
## 程式碼
```python=
while True:
    try:
        guard,b = map(int,input().split())
        food = guard * b

        day = 0
        minus = 0
        while food > 0:
            #day +1
            day += 1
            food -= guard
            if food <= 0: break
            minus += guard
            #guards leave
            while minus >= b:
                guard -= 1
                minus -= b
            
        print(day)

    except:
        break
