/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Max { static int calc(int n) { if (n <= 1) return 1; else return n * calc(n - 1); } static int turn = 1; static int[] solve(int[] A) { int[] B=new int[calc(A.length)]; int[] C=new int[A.length]; // Return the sum of S(S(A)) modulo 10^9+7. int j=0; int b=0; for(int k=0; k< A.length; k++){ for(int i=0; i<=A.length-k-1; i++){ Arrays.fill(C,0); j=i+k; for(int m=i,p=0; p<=j && m<=j; m++,p++) C[p]=A[m]; int max = C[0]; for(int c = 0; c < C.length; c++) { if(max < C[c]) { max = C[c]; } } B[b++]=max; } } return B; } static int solve1(int[] A) { int[] B=new int[calc(A.length)]; int[] C=new int[A.length]; // Return the sum of S(S(A)) modulo 10^9+7. int j=0; int b=0; for(int k=0; k< A.length; k++){ for(int i=0; i<=A.length-k-1; i++){ Arrays.fill(C,0); j=i+k; for(int m=i,p=0; p<=j && m<=j; m++,p++) C[p]=A[m]; int max = C[0]; for(int c = 0; c < C.length; c++) { if(max < C[c]) { max = C[c]; } } B[b++]=max; } } int sum=0; for(int i=0; i