标签:oid lld \n span freopen fclose ace can scanf
AC代码:
#include <iostream> #include <cstdio> #define Max 100005 using namespace std; int a[Max]; int main(void) { freopen("in.txt","r",stdin); int T,count=0; long long n; scanf("%d",&T); while(T--) { int head=1,rear,curhead=1; long long sum=0,max=-2000; scanf("%lld",&n); for(int i=1;i<=n;i++) { scanf("%d",&a[i]); if(sum<0) { sum=a[i]; curhead=i; } else { sum+=a[i]; } if(max<sum) { head=curhead; rear=i; max=sum; } } count++; if(T!=0) printf("Case %d:\n%lld %d %d\n\n",count,max,head,rear); else printf("Case %d:\n%lld %d %d\n",count,max,head,rear); } fclose(stdin); return 0; }
标签:oid lld \n span freopen fclose ace can scanf
原文地址:https://www.cnblogs.com/phaLQ/p/10030022.html