Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Oh my God!!!!! Why WA!!!!!!!

Posted by PK_ILGYU at 2006-04-05 13:28:22 on Problem 2796
#include<stdio.h>
#define Max_n 100000

__int64 Max;

int N,St,Ed;

__int64 Data[Max_n+1];

void init()
{
    int i;
    
 //   FILE *fin=fopen("2796.in","r");
   // fscanf(fin,"%d",&N);
	scanf("%d",&N);

    for(i=1; i<=N; i++){
        //fscanf(fin,"%I64d",&Data[i]);
		scanf("%I64d",&Data[i]);
    }
}

void process()
{
    int i,j,k;
	__int64 min,sum;

    for(i=1; i<=N; i++){
        for(j=i; j<=N; j++){
			sum=0; min=Data[i];
            for(k=i; k<=j; k++){
				sum+=Data[k];
				if(min>Data[k]){
					min=Data[k];
				}
			}

            if(Max<sum*min){
                Max=sum*min;
				St=i;
				Ed=j;
            }
        }
    }
}

void output()
{
//    FILE *fout=fopen("2796_2.out","w");
//    fprintf(fout,"%I64d",Max);
	printf("%I64d\n",Max);
	printf("%d %d",St,Ed);
}

int main()
{
    init();
    process();
    output();
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator