SlavCodes

Untitled

Sep 4th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import java.util.*;
  2. public class Test3 {
  3.  
  4. public static void main(String[] args) {
  5. Scanner reader = new Scanner(System.in);
  6. int input = reader.nextInt();
  7. int[][] myArr = new int[input][input];
  8. long filler = 1;
  9. long colFiller = filler;
  10. long sum = 0;
  11.  
  12. for (int i = 1; i <input ; i++,filler*=2,colFiller=filler) {
  13. for (int j = 0; j <i ; j++) {
  14. colFiller*=2;
  15. sum+=colFiller;
  16. }
  17. }
  18. System.out.println(sum);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment