• <input id="auww4"></input>
  • <input id="auww4"><acronym id="auww4"></acronym></input>
  • <input id="auww4"><u id="auww4"></u></input>
    <object id="auww4"><acronym id="auww4"></acronym></object>
    <menu id="auww4"></menu><input id="auww4"><u id="auww4"></u></input>
    <input id="auww4"><u id="auww4"></u></input>
  • F.A.Q
    Hand In Hand
    Online Acmers
    Forum | Discuss
    Statistical Charts
    Problem Archive
    Realtime Judge Status
    Authors Ranklist
     
         C/C++/Java Exams     
    ACM Steps
    Go to Job
    Contest LiveCast
    ICPC@China
    Best Coder beta
    VIP | STD Contests
    Virtual Contests
        DIY | Web-DIY beta
    Recent Contests
    Author ID 
    Password 
     Register new ID

    Re:AC附上一組新的測試數組

    Posted by 16222542 at 2018-10-28 23:14:36 on Problem 1003
    (616)  


    #include <stdio.h>
    #include <stdlib.h>
    
    int main()
    {
        int T,N;
        int a[100001];
        int i,k,n,m;
        int max,sum;
        int start,end;
        scanf("%d",&T);
        for(i=0;i<T;i++)
        {
            scanf("%d",&N);
            for(k=0;k<N;k++)
                scanf("%d",&a[k]);
            max = a[0];
            start = 0;
            end = 0;
            for(n=0;n<N;n++)
            {
                sum = 0;
                for(m=n;m<N;m++)
                {
                    sum += a[m];
                    if(sum>max){
    
                        max = sum;
                        start = n;
                        end = m;
                    }
                }
            }
            printf("Case %d:\n%d %d %d\n",i+1,max,start+1,end+1);
            if(i < T-1)
    			printf("\n");
        }
        return 0;
    }

    Followed by:


    Post your reply here:

    Author ID
    Password
    Title
    Content  
     
    Hangzhou Dianzi University Online Judge 3.0
    Copyright © 2005-2020 HDU ACM Team. All Rights Reserved.
    Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
    Total 0.000000(s) query 4, Server time : 2020-11-09 02:30:35, Gzip enabled
    棋牌