# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
15258 | wlgns88 | 분배 (kriii3_Q) | C++98 | 36 ms | 1856 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |