코딩테스트
[브2] 5622 - 다이얼
int main(){ string str; cin >> str; int res = 0, arr[]{3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,8,9,9,9,10,10,10,10}; for (int i = 0; i
[실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