//자바 초보인데요 동아리 선배가 첫 숙제로 2의1000승 짜오라고 하는데 제가 짠 코드가

// 너무 비효율 적이라고 다시 짜오래요 ㅠㅠ

//근데 계속생각해도 여기서 어떻게 효율적으로 짜야할지 모르겠어요 ..

//여기 능력자 형님들 도와주세요 제발 ㅠㅠ


package Study1;


public class Test {

public static void main(String[] args) {

int[] num1 = new int[350];

num1[0] = 1;

for (int i = 0; i < 1000; i++) { /// 2의1000승 이니까 반복 1000

int temp = 0;///자리수 올라갈때 쓸 변수;

for (int j = 0; j < num1.length; j++) {

if (temp != 0) {

if (((num1[j] * 2) / 10 )== 1) {temp++;}

num1[j] = ((num1[j] * 2) % 10) + 1;

temp--;

} else {

if (((num1[j] * 2) / 10 )== 1) {temp++;}

num1[j] = (num1[j] * 2) % 10;

}

}

}

int result=0;

for(int z:num1)

{

System.out.printf("%d",z);

result+=z;

}

System.out.println("\n"+result);

}

}