poj3061
来源:互联网 发布:seo关键字是什么 编辑:程序博客网 时间:2024/06/05 05:31
#include<stdio.h>#include<iostream>using namespace std;#include<algorithm>const int Max=100010;int main(){ int ans; int n,S,a[Max]; int T; scanf("%d",&T);//还有这句话我没有太明白其意思,The input will finish with the end of file.,我以为要,while(~scanf("%d",&T)),结果错了 while(T--) { int l=0,r=0; int sum=0; scanf("%d%d",&n,&S); for(int i=0; i<n; i++) scanf("%d",&a[i]); ans=n+10;/////////////////////这里不能太大,不然就错了 while(true) { while(sum<S&&r<n) sum += a[r++]; if(sum < S) break; ans=min(ans,r-l); sum = sum-a[l++]; } if (ans > n) ans = 0; printf("%d\n",ans); } return 0;}
阅读全文
0 0
- poj3061
- POJ3061
- poj3061
- poj3061
- poj3061
- poj3061
- poj3061
- POJ3061
- poj3061
- poj3061
- POJ3061 Subsequence
- POJ3061 Subsequence
- POJ3061 Subsequence
- poj3061---Subsequence
- poj3061,3320
- POJ3061-Subsequence
- poj3061 Subsequence
- POJ3061-Subsequence
- 关于6.828实验中的bootloader链接地址与加载地址的思考
- 基于Swift的iOS应用程序开发:使用表格显示并控制数据(二):删除表格中的数据
- GPU编程
- 【转载】图解WebGL&Three.js工作原理
- python科学计算_numpy_函数库
- poj3061
- UI控件之ScrollView
- IntelliJ IDEA 设置代码提示或自动补全的快捷键
- mybatis进阶(1)--高级映射之数据模型分析
- Linux学习第一课
- 整合Spring+SpringMVC+Hibernate配置信息
- wireshark中查看ssl报文的小问题
- java -jar启动jar包时携带参数不起效的解决办法
- 苹果审核崩溃Crash信息解析