POJ 3061
来源:互联网 发布:uniprot数据库教程 编辑:程序博客网 时间:2024/05/17 03:05
#include <iostream>#include <cstring>#include <string>#include <algorithm>#include <cstdio>using namespace std;#define maxn 100000#define INF 0x7ffffffint n, S, a[maxn];void solve(){ int s = 0, t = 0; int res = INF; int sum = 0; for(;;) { while(t < n && sum < S) sum += a[t++]; if(sum < S) break; res = min(res, t - s); sum -= a[s++]; } if(res != INF) cout<<res<<endl; else cout<<0<<endl;}int main(){ int T; cin>>T; while(T--) { cin>>n>>S; for(int i=0; i<n; i++) scanf("%d", &a[i]); solve(); } return 0;}
1 0
- poj 3061
- poj 3061
- poj 3061
- poj-3061
- POJ 3061
- poj 3061
- poj 3061
- POJ----3061
- poj 3061
- 【POJ】3061
- poj 3061
- POJ 3061
- 【poj】 3061
- 尺取法专题 POJ 3061 POJ 3320 POJ 2566
- poj 3061 Subsequence
- poj 3061(高效枚举)
- POJ-3061-Subsequence
- POJ - 3061 Subsequence
- BouncyCastle 中使用SM3做hash
- Java实现二叉排序树
- android获取新增的图片
- VC硬盘读写功能封装
- ACdream之kmp
- POJ 3061
- linux 下Opencv安装
- reverse interger --- leetcode
- POJ 3320
- 查看oracle当前session
- QTCreator添加链接库
- java tcp 传送任意文件
- 黑马程序员——Java基础中的输入输出流(I/O)
- Java设计模式之状态模式