top of page

소스 코드 제출

공개·회원 50명

2025.07.13

/*

#include <stdio.h>

int queue[2][1000011]={},front=-1,back=-1;

int n,m,p,q,i,j,a,b,c,d,num=0,cnt=0;

int flag=0;

int arr[1101][1101]={};

int push(int x,int y)

{

if(x==c && y==d)

{

flag = 1;

return;

}

if(x>n||y>n||x<1||y<1||arr[x][y]!=0)

{

return ;

}

queue[0][++back]=x;

queue[1][back]=y;

arr[x][y]=num;

return ;

}

int main()

{

scanf("%d %d %d",&n,&a,&b);

push(a,b);

scanf("%d %d",&c, &d);

m=back;

num++;

while(1)

{

front++;

p=queue[0][front];

q=queue[1][front];

push(p+2,q+1);

push(p+2,q-1);

push(p-2,q+1);

push(p-2,q-1);

push(p+1,q+2);

push(p-1,q+2);

push(p+1,q-2);

push(p-1,q-2);

if(flag)

{

printf("%d",num);

return 0;

}

if(m==front)

{

m=back;

num++;

}

}

return 0;

}

*/

/*

#include <stdio.h>

int m,n,a,b,c,d,p,q,f=0,board[1100][1100]={},move=0;

int queue[2][1000011]={},front=-1,back=-1;


void push(int x,int y)

{

if(x<1||x>n||y<1||y>n || board[x][y]!=0)

{

return ;

}

queue[0][++back]=x;

queue[1][back]=y;

board[x][y]=1;

if(x==c&&y==d)

{

f=1;

}

}

//void view()

//{

// printf("\nqueue >>\n");

// for(int i=front+1;i<=back;i++)

// printf("%d ",queue[0][i]);

// printf("\n");

// for(int i=front+1;i<=back;i++)

// printf("%d ",queue[1][i]);

// printf("\n");

//}

int main()

{

scanf("%d %d %d %d %d",&n,&a,&b,&c,&d);

push(a,b);

m=back;

while(1)

{

front++;

p=queue[0][front];

q=queue[1][front];

push(p+2,q+1);

push(p+2,q-1);

push(p-2,q+1);

push(p-2,q-1);

push(p+1,q+2);

push(p-1,q+2);

push(p+1,q-2);

push(p-1,q-2);

if(f==1)

{

break;

}

if(m==front)

{

m=back;

move++;

}

}

printf("%d",move+1);

return 0;

}


#include <stdio.h>

int n,c,arr[111]={};

int main()

{

int i,j,temp;

scanf("%d %d",&n,&c);

for(i=1;i<=n;i++)

{

scanf("%d",&arr[i]);

}

for(i=1;i<n;i++)

{

for(j=1;j<n-i+1;j++)

{

if(arr[j]>arr[j+1])

{

temp=arr[j+1];

arr[j+1]=arr[j];

arr[j]=temp;

}

}

}

for(i=1;i<=n;i++)

{

printf("%d ",arr[i]);

if(i%c==0)

{

printf("\n");

}

}

return 0;

}

*/

1412 1617 1929 4896 1930 1485 1507 4846

3회 조회
주소 : 경기도 용인시 광교중앙로 302 블루 스퀘어 602호
연락처 : 031) 216 - 1546 ,     031) 215 - 1546
사업자등록번호 : 465-92-00916
​학원 등록 제 4603호
bottom of page