5014

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

180206_5014_스타트링크

//https://www.acmicpc.net/problem/5014 #include #include using namespace std;int BD[1000001];int F,S,G,U,D;int mn=10000003; bool bfs(){ queue q; q.push(S); BD[S]=1; while(!q.empty()){ int now=q.front(); q.pop(); if(now==G){ if(mn>BD[now]) mn=BD[now]; return true; } int nu=now+U; int nd=now-D; if(nu>0 && nu0 && nd> F >> S >> G >> U >> D; if(bfs()) cout

bong sue
'5014' 태그의 글 목록