Created
March 22, 2018 01:56
-
-
Save jwon0615/9e9e465bbd3b2c1f42f9637525d3737b to your computer and use it in GitHub Desktop.
1491 : [기초-배열연습] 2차원 배열 달팽이 채우기 4-8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define MAXN 1000; | |
#define MAXM 1000; | |
int n, m; | |
arr[MAXN][MAXM] | |
void escargo(int n,int m){ | |
int x=n, y=1; | |
int cnt = n*m; | |
while(cnt>=1){ | |
while(arr[x][y]==0&&x>0){ | |
arr[x--][y]=cnt--; | |
} | |
while(arr[x][y]==0&&x<=n){ | |
arr[x++][y]=cnt--; | |
} | |
while(arr[x][y]==0&&y>0){ | |
arr[x][y--]=cnt--; | |
} | |
while(arr[x][y]==0&&y<=m){ | |
arr[x][y++]=cnt--; | |
} | |
y++,x--; | |
} | |
int main(){ | |
scanf("%d %d", &n, &m); | |
retrun 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment