본문 바로가기

Computer Science304

정식이의 은행업무 1. 오케이?2. 2진수, 3진수를 받음3. 배타적 OR 를 처리함4. 3진수 값을 하나씩 바꿔가면서5. 2의 제곱승으로 나타낼 수 있는지 확인함6. 비트 연산 필요함 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556#include#define MAX 5 int TC, IMPOS;char mod2[MAX], mod3[MAX];typedef unsigned long long llu;llu ANS, val2, val3;; void init() { IMPOS = 1; val2 = val3 = 0;}void scan() { scanf("%s", &mod2); scanf("%s".. 2019. 2. 18.
pacman basic #define _CRT_SECURE_NO_WARNINGS #include #include #include using namespace std; struct Agent{int direction;int row;int col;int scareDuration;bool isAlive;Agent() {};Agent(int _row, int _col, bool _isAlive) :row(_row), col(_col), isAlive(_isAlive){direction = 0;scareDuration = 0;}};struct Information{int colSize;int rowSize;char map[31][58];Agent pacman;Agent ghost[4];int numGhost;}; extern int g.. 2019. 2. 18.
모음이 보이지 않는 사람 1. 모음을 프린트 하지 않도록 처리2. swith 문 사용함3. 끝 123456789101112131415161718192021222324252627#include int main(void){ freopen("input.txt", "r", stdin); int T, test_case; char input[20]; scanf("%d", &T); for (test_case = 1; test_case 2019. 2. 13.
세상의 모든 팰린드롬 1. 오케이요 2. 문제 읽고 그대로 코딩하기3. 컨디션 조절 해얗마4. 오케이 1234567891011121314151617181920212223242526272829303132333435#include int main(){ freopen("input.txt", "r", stdin); int testCase; char buf[21]; int len; scanf("%d", &testCase); for (int i = 0; i 2019. 2. 13.
세상의 모든 팰린드롬 2 1. 오케이2. 앞과 뒤에서 한칵씩 접근하기3. 생각나는 설계 풀이 그대로 풀이하기 1234567891011121314151617181920212223242526272829303132333435363738394041#include char data[21];int main(){ freopen("input.txt", "r", stdin); int tc; scanf("%d", &tc); while(tc--) { scanf("%s", data); int l = 0; int sw = 1; while (data[++l] != '\0'); int j = l - 1; int i = 0; while (i 2019. 2. 13.
초콜릿과 건포도 1. 후2. 안타깝다3. DP 어떻게 풀이하는지 조금 더 문제를 접해봐야함4. 정의가 확실해야함5. 인덱스와 값에 무엇이 들어가는지 그리고 어떻게 사용할지 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152#include#includeusing namespace std;typedef unsigned long long ll; #define N_MAX 5int N, M, A[N_MAX][N_MAX], D[N_MAX][N_MAX][N_MAX][N_MAX], S[N_MAX][N_MAX], INF = (int)1e9;inline int g(int r1, int c1, int r2, int c2).. 2019. 2. 12.
석찬이의 받아쓰기 1. 문자 비교2. 끝 1234567891011121314151617181920#include const int MAXN = 15;char gstr[MAXN + 1];char sstr[MAXN + 1];int tc, T, N, ans; int main(void){ freopen("input.txt", "r", stdin); for (tc = scanf("%d", &T); tc 2019. 2. 12.
배열의 분할 1. 오케이2. 이정도는 무난하쥬3. 오름차순, 내림차순 1234567891011121314151617181920212223242526272829303132333435363738394041424344#include const int ASC = 1, DESC = -1, MAXN = 10;int a[MAXN];int tc, T, n; int solve(void){ int ans = 1; int order = 0; for (int i = 1; i a[i]) order = DESC; // 내림 else order = ASC; // 오름차순 } else { if (a[i - 1] > a[i] && order == ASC || // 오름이거나, 내림이면 a[i - 1] 2019. 2. 12.
재미있는 오셀로 게임 1. 끝단 처리는 어떻게 했는지2. 방향에 대해서 검사를 진행함3. 오케이4. 무엇인가가 놓여져 있어야 함5. 규칙을 명확하게 파악하고6. 코딩 시작함 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596#include int tc; int map[10][10];const int dx[8] = { -1,-1,-1,0,0,1,1,1 };const int dy[8] = { -1,0,1,-1,1,-1,0,1 }; const int WHIT.. 2019. 2. 12.