poj 3061(高效枚举)
来源:互联网 发布:淘宝店退货的店铺多么 编辑:程序博客网 时间:2024/06/05 02:36
#include <iostream>using namespace std;int b[100005]; int main(){int n,s,i,j,ans,x,t;cin>>t;while(t--){cin>>n>>s;for(i=1;i<=n;i++){cin>>x;b[i]=x+b[i-1];}ans=n+1;for(i=j=1;j<=n;j++){if(b[i-1]>b[j]-s) continue;while(b[i]<=b[j]-s) i++;ans=min(ans,j-i+1);}if(ans==n+1) cout<<0<<endl;else cout<<ans<<endl;}return 0;}
- poj 3061(高效枚举)
- poj Subsequence 3061 (高效&DP)
- poj2965 (枚举+高效)
- hdu 3486(RMQ+高效枚举)
- 高效的枚举元素集合
- 高效的枚举元素映射
- poj 3102(暴力枚举)
- POJ-1018 枚举
- POJ 1753 枚举
- poj 1024 贪心、枚举
- POJ 1018 枚举+贪心
- poj 1753 枚举+深搜
- poj 1840 枚举
- POJ 1042(枚举+贪心)
- poj 1062 dijisktra+枚举
- POJ 2586 枚举
- poj 1944 模拟 枚举
- POJ 2002 hash+枚举
- Spring事务-所有客户端代码
- hdu 2044 一只小蜜蜂
- SSH和dwr整合实现在同一个页面的增加修改时id不一致的问题
- udp通信简单实例
- FAQ_22 Cursor 遍历数据库
- poj 3061(高效枚举)
- windows8开发-使用工作线程与更新UI
- 解决ld: cannot find -lXX之类的问题
- Hibernate防止SQL注入
- 让Erlang服务器后台运行
- sql视图操作注意事项
- oracle 的数据导入、导出
- 如何写一个精简的Makefile
- JS后退一页