BOJ

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

180209_3052_나머지

//https://www.acmicpc.net/problem/3052 #include using namespace std;int num[1001];int main(){ int mx=0; int ans=0; for(int i=0; i> A; num[A%42]++; if(A>mx) mx=A; } for(int i=0; i0) ans++; } cout

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

180208_1963_소수 경로

//https://www.acmicpc.net/problem/1963 #include #include using namespace std;int T,a,b;int num[9000]; void input(){ cin >> a >> b;} void init(){ for(int i=0; i0) cout

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

180207_2606_바이러스

//https://www.acmicpc.net/problem/2606 #include #include using namespace std;int N, M, cnt;bool network[101][101];bool visited[101]; void input(){ cin >> N >> M; int a,b; for(int i=0; i> a >> b; network[a][b]=network[b][a]=1; }} void bfs(){ queue q; q.push(1); visited[1]=1; while(!q.empty()){ int now=q.front(); q.pop(); for(int i=2; i

알고리즘 문제 풀이/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
'BOJ' 태그의 글 목록 (12 Page)