- js24012 的博客
D2110O 母鸡下蛋
- @ 2026-4-22 16:43:48
D2110O 母鸡下蛋
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,t,a[1000005],cnt=0xfffffff;
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>> n >> t;
for(int i = 1;i <= n;i++){
int x;
cin >> x;
a[i]=a[i-1]+x;
}
int l = 1;
for(int r = 1;r <= n;r++){
while(l <= r && a[r]-a[l-1]>=t){
cnt=min(cnt,r-l+1);
l++;
}
}
if(cnt == 0xfffffff)cout<< "Angry";
else cout<< cnt;
return 0;
}