Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Oh my God!!!!! Why WA!!!!!!!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator