코딩테스트
[브3] 29722 - 브실혜성
int main(){ // 문자열 생성 string str; int n; stringstream ss; cin >> str >> n; ss nums; while (ss >> num) nums.push_back(abs(num)); // 튜플 생성 auto t = make_tuple(nums[0], nums[1], nums[2]); int y, m, d; tie(y, m, d) = t; d += n; m += (d - 1) / 30; d = (d - 1) % 30 + 1; y += (m - 1) / 12; m = (m - 1) % 12 + 1; cout
[브3] 2476 - 주사위 게임
int main(){ int n, res = 0; cin >> n; while (n--) { int a, b, c, sum = 0; cin >> a >> b >> c; if (a == b && a == c && b == c) sum = 10000 + a * 1000; else if (a != b && a != c && b != c) { int biggest = max(a, max(b, c)); sum = biggest * 100; } else { int val = 0; if (a == b || a == c) val = a; //else if (b == c) else val = b; sum = 1000 + val * 100; } res = max(r..
[브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..