はまやんはまやんはまやん

hamayanhamayan's blog

Golden Apple [AtCoder Beginner Contest 134 B]

https://atcoder.jp/contests/abc134/tasks/abc134_b

解説

https://atcoder.jp/contests/abc134/submissions/6478072

監視員がカバーできる範囲は[i-D,i+D]なので、2D+1の範囲をカバーできる。
よって、len=2D+1とすると、N/Dの切り上げが必要な監視員の最少人数となる。

int N, D;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> D;

    int len = D * 2 + 1;
    int ans = (N + len - 1) / len;

    cout << ans << endl;
}