poj Subsequence
来源:互联网 发布:网络最新赚钱方法 编辑:程序博客网 时间:2024/05/21 18:51
Description
Input
Output
Sample Input
210 155 1 3 5 10 7 4 9 2 85 111 2 3 4 5
Sample Output
23
#include <iostream>#include <cstdio>using namespace std;const int N = 100010;int a[N];int main(){ int t; scanf("%d", &t); while(t--) { int n, s; scanf("%d %d", &n, &s); for(int i=0;i<n;i++) { scanf("%d",&a[i]); } int res=n+1; int l=0, r=0, sum=0; for(;;) { while(r<n&&sum<s) { sum+=a[r++]; } if(sum<s) { break; } res=min(res,r-l); sum-=a[l++]; } if(res>n) { printf("0\n"); } else { printf("%d\n",res); } } return 0;}
- poj Subsequence
- Subsequence POJ
- poj Subsequence
- POJ:Subsequence
- Common Subsequence--poj--1458
- poj 1458 Common Subsequence
- poj 3061 Subsequence
- poj 1458 Common Subsequence
- Common Subsequence poj 1548
- Poj 1458 Common Subsequence
- [POJ] 3302 Subsequence
- POJ 1458 Common Subsequence
- poj 1458 Common Subsequence
- poj 1458 Common Subsequence
- POJ 1458 Common Subsequence
- poj 1458 Common Subsequence
- POJ-3061-Subsequence
- POJ-1458-Common Subsequence
- 数据结构---------二叉搜索树
- golang post取参数的一些问题
- 经典聚类算法——K-means
- android 自定义textview跑马灯效果
- printf()的用法!!!
- poj Subsequence
- 【全解析】屏幕尺寸,分辨率,像素,PPI之间到底什么关系?for 屏幕适配
- 冒泡排序详解(从小到大)
- 索引分析
- java Lambda exp Aggregate聚合总体 Operations
- sql语法大全
- 用ACE实现生产者-消费者模式
- js和Jquery获取选中select值和文本
- getpgid()函数