-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBOJ13549.cpp
48 lines (48 loc) · 1.01 KB
/
BOJ13549.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
////
//// Created by 전형진 on 2019-04-02.
////
//
//#include <stdio.h>
//#include <queue>
//#include <vector>
//
//int arr[100001];
//int c[100001];
//using namespace std;
//int n,k;
//
//void bfs() {
// int dx[] = {1, -1};
// queue<int> q;
// q.push(n);
// c[n] = 1;
//
// int nx;
// while (!q.empty()) {
// int x = q.front();
// q.pop();
// for (int i = 0; i < 2; i++) {
// nx = x + dx[i];
// if (nx < 0 || nx >100000) continue;
// if (c[nx] == 0 || c[nx] > c[x] + 1) {
// q.push(nx);
// c[nx] = c[x] + 1;
// }
// }
//
// nx = 2 * x;
// if (nx < 0 || nx > 100000) continue;
// if (c[nx] == 0 || c[nx] > c[x]) {
// q.push(nx);
// c[nx] = c[x];
// }
//
// }
// printf("%d",c[k]-1);
//}
//
//int main(){
//
// scanf("%d %d",&n,&k);
// bfs();
//}