데블스 캠프 첫째날 마방진 코드 ---- 첫번째 방법 {{{~cpp #include using namespace std; const int Asize=19; int main() { int input; cout << "원하는 마방진 크기 : "; cin >> input; int i=1, count=0 ,x=input/2 ,y=0; int ground[Asize][Asize]={0,}; while ( count < input*input ) { if (ground[x][y]==0) { ground[x][y]=i; ++i, ++count, ++x, --y; } else//범위를 넘어가는 경우를 조심해야지... { --x, ++y; if (x<0) x=input-1; if (y>input-1) y=0; ++y; if (y>input-1) y=0; } if (x<0) x=input-1; else if(x>input-1) x=0; if (y<0) y=input-1; else if (y>input-1) y=0; } for (int j=0 ; j