Baekjoon(C++) 썸네일형 리스트형 [C++]백준 알고리즘 1002번 풀이는 아래와 같다. 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 #include using namespace std; int main() { ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int T; cin >> T; for(int t=0; t> x1>> y1 >> r1 >> x2 >> y2 >> r2; int ans = 0; double d = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)); if(x1==x2 && y1==y2){ if(.. 더보기 [C++]백준 알고리즘 9020번 풀이는 아래와 같다. 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 #include #include using namespace std; int prime(int num){ int root = (int)sqrt(num); if(num == 2 || num == 3){ return 1; }else{ for(int i=2; i> T; for(int t=0; t> n; int a,b; for(int i=2; i 더보기 [C++]백준 알고리즘 1011번 풀이는 아래와 같다. 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 #include #include using namespace std; int main() { int T; cin >> T; for(int testcase=0; testcase> x >> y; int d = y-x; int max = floor(sqrt(d)); int ans = 0; ans += 2*max - 1; d -= max * max; for(int i=max; i>0; i--){ while(d >= i){ d -= i; ans++; } } cout 더보기 [C++]백준 알고리즘 11729번 풀이는 아래와 같다. 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 #include #include #include using namespace std; vector order; int move(int num){ if(num == 1){ return 1; } return 2*move(num-1)+1; } void solve(int num, int a, int b){ if(num == 1){ order.push_back(make_tuple(a,b)); return; } solve(num-1,a,6-a-b); order.push_back(make_tuple(a,b.. 더보기 [C++]백준 알고리즘 2447번 풀이는 아래와 같다. 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 49 50 51 #include using namespace std; int n; bool stars[6562][6562]; void solve(int num, int a, int b){ if(num == 3){ stars[a+1][b+1] = 1; return; } for(int i=a; i 더보기 이전 1 2 3 4 ··· 6 다음