Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Test3 {
- public static void main(String[] args) {
- Scanner reader = new Scanner(System.in);
- int input = reader.nextInt();
- int[][] myArr = new int[input][input];
- long filler = 1;
- long colFiller = filler;
- long sum = 0;
- for (int i = 1; i <input ; i++,filler*=2,colFiller=filler) {
- for (int j = 0; j <i ; j++) {
- colFiller*=2;
- sum+=colFiller;
- }
- }
- System.out.println(sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment