⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1858.cpp

📁 杭电 acm部分代码 有兴趣的可以下载 谢谢
💻 CPP
字号:
#include<cstdio>
#include<string>
void main()
{
    __int64 n,i,s,e,a,max,l,res;
    int t;
    scanf("%d",&t);
    while(t--){
        scanf("%I64d",&n);
        max=-100000;
        res=0;l=0;
        for(i=0;i<n;i++){
            scanf("%I64d",&a);
            if(res>=0)
                res+=a;
            else{
                res=a;
                l=i;
            }
            if(res>max){
                max=res;
                s=l+1;
                e=i+1;
            }
        }
        printf("%I64d %I64d %I64d\n",max,s,e);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -