문제 : https://www.acmicpc.net/problem/2205
난이도 : 실버4
코드
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int count = sc.nextInt(); boolean[] leadArr = new boolean[count * count]; StringBuffer sb = new StringBuffer(); for (int i = 1; i <= count; i++) { for (int j = 2;; j = j * 2) { if (i >= j || leadArr[j - i]) { continue; } sb.append((j - i) + " \n"); leadArr[j - i] = true; break; } } System.out.print(sb.toString()); } } | cs |
무조건 맞은것같은데
자꾸 틀렸다고해서 빡쳐서 포기함
내일은 실버5로 난이도 낮출 예정
왜 자바로함?
땔감이라 자바밖에 못함
6일때 10이 아니라 2가 나와야됨
한번쓴건 못써서 2쓰면 안댐