よじろめ覚書

私の理解度重視のソースコードです。

ABC022A - Best Body

問題:A - Best Body

#include <cstdio>
#include <iostream>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(void) {
    int n, s, t, w, a, ans = 0;

    scanf ("%d %d %d", &n, &s, &t);
    scanf ("%d", &w);
    if (s <= w && w <= t) {
        ans++;
    }
    REP(i, n - 1) {
        scanf ("%d", &a);
        w += a;
        if (s <= w && w <= t) {
            ans++;
        }
    }

    printf ("%d\n", ans);
    return 0;
}