2012年12月24日 星期一

ITSA20

 
#include<stdio.h>
int main(){
    int n,i,j,cas=1;
    while(scanf("%d",&n)!=EOF){
        long long s[20],max=0,tmp;
        for(i=0;i<n;i++) scanf("%lld",&s[i]);
        for(i=0;i<n;i++){
            tmp=1;
            //max=(max<tmp)? tmp:max;
            for(j=i;j<n;j++){
                tmp*=s[j];
                max=(max<tmp)? tmp:max;
            }
        }
        printf( "Case #%d: The maximum product is %lld.\n\n", cas++, max );
    }
return 0;
}

沒有留言:

張貼留言