시뮬레이션

알고리즘 문제 풀이/1DP_과제(~180615)

180410_2161_카드1

//https://www.acmicpc.net/problem/2161 #include #include using namespace std; queue q;queue card;int main(){ int N; cin >> N; for(int i=1; i

알고리즘 문제 풀이/1DP_과제(~180615)

180408_3190_뱀

//https://www.acmicpc.net/problem/3190 #include #include #include using namespace std;int N, K, L; int map[100][100]; //머리의 방향#define UP 0#define RIGHT 1#define DOWN 2#define LEFT 3//머리의 방향에 따른 다음 이동 방향//UP일 때, ny=y+dy[0], nx=x+dx[0]...int dy[4]={-1,0,1,0};int dx[4]={0,1,0,-1}; //뱀 몸통은 큐를 이용//사과를 먹지않으면 꼬리(=front, 제일 처음 집어넣은 값) pop//매초 이동시에 머리(=back, 제일 마지막에 집어넣은 값) pushqueue snake; int main(){ c..

알고리즘 문제 풀이/1DP_과제(~180615)

180404_14500_테트로미노

//https://www.acmicpc.net/problem/14500 #include #include using namespace std; int map[500][500];bool visited[500][500]; int dy[4]={0,0,1,-1};int dx[4]={1,-1,0,0};int N, M;int mx=0; void solve(int y, int x, int now);void dfs(int y, int x, int now, int depth); int main(){ cin >> N >> M; for(int i=0; i map[i][j]; } } for(int i=0; i

알고리즘 문제 풀이/1DP_과제(~180615)

180404_14499_주사위 굴리기

//https://www.acmicpc.net/problem/14499 #include using namespace std;#define east 1#define west 2#define north 3#define south 4 int map[20][20];class dice{public: int U;//up int B;//bottom int E;//east int W;//west int N;//north int S;//south int y; int x; dice(int _U=0, int _B=0, int _E=0, int _W=0, int _N=0, int _S=0): U(_U), B(_B), E(_E), W(_W), N(_N), S(_S) {}};int dy[5]={0, 0, 0, -1, 1};int..

bong sue
'시뮬레이션' 태그의 글 목록