Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't one, return 0 instead.
For example, given the array
[2,3,1,2,4,3]
ands = 7
, the subarray[4,3]
has the minimal length under the problem constraint思路:尺取即可。。好久没写,竟然调了半 …
阅读更多http://codeforces.com/problemset/problem/279/B 题意:给定一个序列,问一段连续的序列的和小于等于t的最长的序列的长度。 思路:尺取法。三个月前学习的了。
/* *********************************************** Author :111qqz Created Time :2015年12月15日 星期二 20时08分16秒 File Name :code/cf/problem/279B.cpp ************************************************ */
1#include <cstdio> …
阅读更多B. Kefa and Company
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company.
Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend …
阅读更多Jessica's Reading Problem
**Time Limit:** 1000MS **Memory Limit:** 65536K **Total Submissions:** 8787 **Accepted:** 2824 Description
Jessica's a very lovely girl wooed by lots of boys. Recently she has a problem. The final exam is coming, yet she has spent little time on it. If she wants to pass it, she …
阅读更多