/*
A 题,方法:搜索 。。。
题意:要求(0,0)到(x,y)要拐几个弯!!
*/
#include
#include
#include
#include
#include
using namespace std;
#define manx 10000
int sum,xx,yy;
void dfs(int x,int y){
if(x>0 && y>0) {
if(yy==y && xx=(-x)) { cout<
sum++;
dfs(-x,y);
}
else if(x>0 && y<0) {
if(xx==x && yy<=(-y+1) && yy>y){ cout<
sum++;
dfs(x,-y+1);
}
else if(x<0 && y<0) {
if(yy==y && xx<=(-x+1) && xx>x){ cout<
sum++;
dfs(-x+1,y);
}
else if(x<0 && y>0) {
if(xx==x && yy>=(-y) && yy
sum++;
dfs(x,-y);
}
else if(x==0 && y==0){
if(yy==y && xx<=(x+1) && xx>x){ cout<
sum++;
dfs(x+1,y);
}
else if(x==1 && y==0) {
if(xx==x && yy<=(y+1) && yy>y) { cout<
}
sum++;
dfs(x,y+1);
}
int main(){
while(cin>>xx>>yy){
if(xx==0 && yy==0) { cout<<"0"<
sum=0;
dfs(0,0);
}
}
[cpp]
/*
B 题,方法:队列或者模拟。。。
题意:求连续子段和不超过 t 的最大长度。。。
*/
#include
#include
#include
#include
using namespace std;
#define manx 100009
int x[manx];
long long s[manx];
int main(){
int n,t;
while(cin>>n>>t){
long long k=1,max=0,p;
long long sum=0;
for(int i=1;i<=n;i++){
scanf("%d",&x[i]);
sum += x[i];
while(sum>t){
p=i-k;
if(max
sum -= x[k];
k++;
}
}
if(sum<=t) {
p=n-k+1;
if(max
}
cout<
}
}
/*
4 5
3 1 2 1
4 6
3 1 1 4
*/