用户工具

站点工具


2020-2021:teams:no_morning_training:poj3061

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
2020-2021:teams:no_morning_training:poj3061 [2020/05/13 22:46]
shaco
— (当前版本)
行 1: 行 1:
-<code cpp> +
-#​include<​cstdio>​ +
-using namespace std; +
-int n,​s,​t,​a[100005];​ +
-int min(int x,int y) +
-+
-    if(x==-1) +
-        return x; +
-    if(x>​y) +
-        return y; +
-    return x; +
-+
-int main() +
-+
-    scanf("​%d",&​t);​ +
-    while(t--) +
-    { +
-        scanf("​%d%d",&​n,&​s);​ +
-        for(int i=1;​i<​=n;​i++) +
-            scanf("​%d",&​a[i]);​ +
-        a[n+1]=0; +
-        int left=1,​right=1,​length=100005;​ +
-        long long sum=a[1]; +
-        while(right<​=n) +
-        { +
-            if(sum>​=s) +
-            { +
-                length=min(length,​right-left+1);​ +
-                sum-=a[left++];​ +
-            } +
-            else sum+=a[++right];​ +
-        } +
-        if(length==100005) +
-            length=0; +
-        printf("​%d\n",​length);​ +
-    } +
-    return 0; +
-+
-</​code>​+
2020-2021/teams/no_morning_training/poj3061.1589381214.txt.gz · 最后更改: 2020/05/13 22:46 由 shaco