답안 #20224

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
20224 2016-04-22T00:57:35 Z byrage 분배 (kriii3_Q) C
0 / 24
1 ms 0 KB
#include <stdio.h>

int main(){
  int n,k,i,j,t = 0;
  scanf("%d%d",&n, &k);
  
  for (i = 0; i < (1 << k); i++) {
	for (j = 0; j < (1 << n - 1); j++) {
		if (j == (1 << n - 1) / 2 ) {
			t = (1 << n - i - 1);
			}
      
			printf("%d ", j + t);
		}
		t = t >> 1;
		printf("\n");
	}
}

Compilation message

Q.c: In function 'main':
Q.c:8:26: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
  for (j = 0; j < (1 << n - 1); j++) {
                          ^
Q.c:9:20: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   if (j == (1 << n - 1) / 2 ) {
                    ^
Q.c:10:20: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
    t = (1 << n - i - 1);
                    ^
Q.c:5:3: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&n, &k);
   ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 0 KB Output is correct
2 Correct 1 ms 0 KB Output is correct
3 Incorrect 1 ms 0 KB Output isn't correct