'시뮬레이션' 태그의 글 목록 (3 Page)
본문 바로가기
728x90
반응형

시뮬레이션98

2022-04-25-21610-마법사상어와비바라기 01.구름이동 int dir, S; scanf("%d %d", &dir, &S); S = S % N; for (int c = 0; c < cloud.size(); c++) {// 구름이동 for (int s = 0; s < S; s++) { Data n; n.y = cloud[c].y + dy[dir]; n.x = cloud[c].x + dx[dir]; if (n.y == 0) n.y = N; else if (n.y == N + 1)n.y = 1; if (n.x == 0) n.x = N; else if (n.x == N + 1)n.x = 1; cloud[c].y = n.y; cloud[c].x = n.x; } } 02.구름 위치에 비1씩 증가 int visit[NS][NS] = { 0 };// 사라지는 .. 2022. 4. 25.
2022-04-25-20057-마법사상어와토네이도 01.달팽이 배열 움직임 while (1) { if (y == 2 && x == 2)break; if (N - 1 == num) cnt = 3; for (int c = 0; c < cnt; c++) { for (int n = 0; n < num; n++) { int ny = y + dy[dir]; int nx = x + dx[dir]; int sum = 0; for (int i = 0; i < 9; i++) { int nny = ny + dy_rate[dir][i]; int nnx = nx + dx_rate[dir][i]; int sand = board[ny][nx] * rate[i]; board[nny][nnx] += sand; sum += sand; } board[ny][nx] -= sum; boar.. 2022. 4. 25.
2022-04-25-20056-마법사와파이어볼 01.방향이동 가장 중요 before for (int f = 0; f < fireBall.size(); f++) { Data c = fireBall[f]; Data n = c; for (int s = 0; s < fireBall[f].s; s++) { n.y = c.y + dy[c.d]; n.x = c.x + dx[c.d]; if (n.y == -1)n.y = N - 1; else if (n.y == N)n.y = 0; if (n.x == -1) n.x = N - 1; else if (n.x == N) n.x = 0; c.y = n.y; c.x = n.x; } fireBall[f] = n;//다시 재저장 } after for (int i = 0; i < fireBall.size(); i++) {//파이어.. 2022. 4. 25.
2022-04-24-17822-원판돌리기 01.시계방향또는 반시계방향으로 이동하기 void clockArr(int idx, int arr[MS]) { int copy = arr[M-1]; for (int i = M-1; i >0; i--) { arr[i] = arr[i - 1]; } arr[0] = copy; } void clockArrReverse(int idx, int arr[MS]) { int copy = arr[0]; for (int i = 0; i 2022. 4. 24.
728x90
반응형