제출 #15258

#제출 시각아이디문제언어결과실행 시간메모리
15258wlgns88분배 (kriii3_Q)C++98
24 / 24
36 ms1856 KiB
#include <iostream> #include <cmath> using namespace std; int main(void) { int N, K, i, j, index, rows, cols, num_len; int num[65525]; //N = 8, K = 1; cin >> N; cin >> K; // rows, cols 구하기 rows = pow((double)2, K); num_len = pow((double)2, N); cols = num_len/rows/2; // 전체 숫자 구하기 for(i=0; i<num_len; i++) { num[i] = i; } // 상자에 들어갈 수 출력하기 index = 0; for(i=0; i<rows; ++i) { for(j=0; j<cols; ++j) { cout << num[index] << ' ' << num[num_len-1-index]; if (j < cols-1) cout << ' '; index++; } cout << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...