Skip to content

Instantly share code, notes, and snippets.

@jwon0615
Created March 22, 2018 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwon0615/9e9e465bbd3b2c1f42f9637525d3737b to your computer and use it in GitHub Desktop.
Save jwon0615/9e9e465bbd3b2c1f42f9637525d3737b to your computer and use it in GitHub Desktop.
1491 : [기초-배열연습] 2차원 배열 달팽이 채우기 4-8
#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