# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
15258 | wlgns88 | 분배 (kriii3_Q) | C++98 | 36 ms | 1856 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |