For this Question: Given an array of positive integers A of size N. The power of an array is defined as sum of all elements in it. Calculate the sum of powers of all possible odd - length subarrays.
A subarray is a contiguous subsequence of the array.First line contains an integer N.
Next line contains N space separated integers denoting elements of array.

Constraints
1 <= N <= 1000
1 <= Ai <= 10^5Print the sum of powers of all possible odd - length subarrays.Sample Input 1:
5
1 4 2 5 3

Output 
58

Explanation: 
The odd- length subarrays of A and their sums are:
[1] = 1
[4] = 4
[2] = 2
[5] = 5
[3] = 3
[1, 4, 2] = 7
[4, 2, 5] = 11
[2, 5, 3] = 10
[1, 4, 2, 5, 3] = 15
If we add all these together we get 1 + 4 + 2 + 5 + 3 + 7 + 11 + 10 + 15 = 58

Sample Input 2:
2
1 2

Output 
3

Explanation:
There are only 2 subarrays of odd length, [1] and [2]. Their sum is 3., I have written this Solution Code: import java.io.*;
import java.util.*;
class Main
{
    public static void main (String args[]) throws IOException
    {   
        BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
    	int n=Integer.parseInt(br.readLine());
    	long a[] = new long[n];
        String line = br.readLine(); // to read multiple integers line
        String[] strs = line.trim().split("\\s+");
        for (int i = 0; i < n; i++) {
            a[i] = Long.parseLong(strs[i]);
        }
        long[] prefix=new long[n];
        prefix[0]=a[0];
        for(int i=1;i<n;i++){
            prefix[i]=prefix[i-1]+a[i];
        }
        long ans=0;
        for(int i=0;i<n;i++){
            for(int j=0;j<=i;j++){
                if((i-j+1)%2==1){
                    if(j==0)ans+=prefix[i];
                    else ans+=prefix[i]-prefix[j-1];
                }
            }
        }
    	System.out.print(ans);
    }
}

, In this Programming Language: Java, Now tell me if this Code is compilable or not?