• <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 lightninghe at 2014-08-22 10:46:42 on Problem 1003
    (616)  


    感謝樓主的測試數據。下面是我的代碼:
    #include <stdio.h>
    
    #define N 10000
    
    int main()
    {
        int A[N];
        int i,j,start,end,result,max,n,num;
        int start_index,s=0;
        scanf("%d",&n);
        while(n--)
        {
            scanf("%d",&num);
            for(i=0;i<num;i++){scanf("%d",&A[i]);}
            start=0;end=0;result=0;max=A[0];
            start_index=0;
            for(j=0;j<num;j++)
            {
                result+=A[j];
                if(result>max){start_index=start;end=j;max=result;}
                if(result<0){start=j+1;result=0;}
            }
            s++;
            printf("Case %d:\n",s);
            printf("%d %d %d",max,start_index+1,end+1);
            if(n>0)printf("\n\n");
            else printf("\n");
        }
    }
    
    表示樓主給的測試數據都過了,但依舊是wrong answer...
    求指導。:-)

    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:31:09, Gzip enabled
    棋牌