코딩테스트/백준
[실4] 1018 - 체스판 다시 칠하기
#pragma region 라이브러리#include //#include #include #include #include #include #include #include #include using namespace std;#pragma endregion#pragma region 최적화용#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0);#define y first#define x second#define INIT 9876543210#define MAX_SIZE 8using IntPair = pair;using DoubleVec = vector>;using Vec = vector;// 상하좌우IntPair dir[]{ { 1, 0 }, {-1, 0 }, { 0, ..
[브2] 2798 - 블랙잭
#pragma region 라이브러리#include //#include #include #include #include #include #include #include #include using namespace std;#pragma endregion#pragma region 최적화용#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0);#define y first#define x second#define INIT 9876543210using IntPair = pair;using DoubleVec = vector>;using Vec = vector;// 상하좌우IntPair dir[]{ { 1, 0 }, {-1, 0 }, { 0, -1 }, { 0, 1 }};#p..
[실4] 9012 - 괄호
#pragma region 라이브러리#include #include #include #include #include #include #include #include using namespace std;#pragma endregion#pragma region 최적화용#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0);#define x first#define x secondusing IntPair = pair;using DoubleVec = vector>;using Vec = vector;// 상하좌우IntPair dir[]{ { 1, 0 }, {-1, 0 }, { 0, -1 }, { 0, 1 }};#pragma endregionint main() { int t;..
[실4] 10773 - 제로
#pragma region 라이브러리#include #include #include #include #include #include #include #include using namespace std;#pragma endregion#pragma region 최적화용#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0);#define x first#define x secondusing IntPair = pair;using DoubleVec = vector>;using Vec = vector;// 상하좌우IntPair dir[]{ { 1, 0 }, {-1, 0 }, { 0, -1 }, { 0, 1 }};#pragma endregionint main() { int t;..
[브1] 10798 - 세로읽기
#include #include #define SIZE 9#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0);#define x first#define x secondusing namespace std;int main() { int n = 5; vector v(n); while (n) { int idx = 5 - n; cin >> v[idx]; n--; } for (int x = 0; x
[브1] 14467 - 소가 길을 건너간 이유 1
#include #include using namespace std;int main() { int n; cin >> n; vector v(n + 1, -1); int cnt = 0; while (n--) { int a, b; cin >> a >> b; int cur = v[a]; if (v[a] != b) { v[a] = b; // 첫 초기화 값 if (cur == -1) continue; cnt++; } } cout
[실4] 10866 - 덱 (함수포인터 이용)
#pragma region 라이브러리#include #include #include #include #include #include #include #include #include #include using namespace std;#pragma endregion#pragma region 최적화용#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0);#define y first#define x secondusing IntPair = pair;#pragma endregionint main(){ deque dq; map> funcs { {"push_front", [&](int x) { dq.push_front(x); } }, {"push_back", [&](int..
[브4] 13136 - Do Not Touch Anything
다른 재밌는 문제int main(){ long r, c, n; cin >> r >> c >> n; cout
[브5] 20492 - 세금
식이 재밌어서 남김int main(){ long n; cin >> n; int ans1 = n * 0.78; int ans2 = n * 0.8 + (n * 0.2 * 0.78); cout
[실3] 1002 - 터렛
#include #include #include #include #include using namespace std;int main(){ int t; cin >> t; while (t--) { int x1, y1, r1, x2, y2, r2; cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2; double d = sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)); double sub = r1 > r2 ? r1 - r2 : r2 - r1; int sum = r1 + r2; if (d == 0 && r1 == r2) cout sub && d