1806
[골5] 1806 - 부분합
#include #include #include using namespace std; #define MAX 987654321 int main() { int n, r; cin >> n >> r; vector v(100001); for (int i = 0; i > v[i]; int s = 0, e = 0, res = MAX; int sum = v[0]; while (true) { if (sum >= r) { res = min(res, e - s + 1); sum -= v[s++]; } else { if (++e == n) break; sum += v[e]; } } cout