본문 바로가기

Computer Science304

Intersection 1. 수직선2. 수평선3. 기울기4. 경우의 수를 두고, 그것을 풀이함5. 직선과 선분의 교차점 구하기 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104#includedouble Xmin, Ymin, Xmax, Ymax, X1, Y1, X2, Y2, gradient;int answer;double Max(double num1, double num2){ if (num1 2019. 2. 10.
팰린드롬 1. 팰린드롬2. 다른 코드가 있는 것 아님3. 찾을 수 있음4. 중앙점, 가운데점5. 오케이 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647#include char s[15]; int main(void){ freopen("input.txt", "r", stdin); int t = 0, tc = 0; s[0] = 1; scanf("%d", &t); while (tc++ 2019. 2. 10.
이진 문자열 복원 1. 규칙을2. 수식화해서3. 코딩함 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152#include int T, a, b, c, d, i; int main(void){ freopen("input.txt", "r", stdin); scanf("%d", &T); for (int tc = 1; tc 0) for (i = 0; i 2019. 2. 8.
운동 1. 링크드 리스트2. 힙 사용3. 음.. 내 코드로 만들어서 사용하기4. 더블 링크드 리스트5. 내 코드로 만들어서 사용하기....후.... 1. 디피2. 디피로 문제 풀 수 있는 유형 존재3. 유형 파악 가능함4. 오케잉. 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261.. 2019. 2. 7.
1. 하나의 포문으로2. 그리고 대소 비교 2개로 인해서3. 한 단락 중 최대값과4. 한 단락 중 음수 인지를 체크 할 수 있음 123456789101112131415161718192021222324252627282930313233#include #include #include using namespace std; #define FOR(i, n) for(int i=0; i T; FORe(test_case, 1, T + 1) { int n; cin >> n; int arr[10]; int total = 0; int maxAt = -9999; FOR(i, n) { cin >> arr[i]; total = max(0, total) + arr[i]; // 이전까지 점수 total + arr[i] 현재 -> to.. 2019. 2. 3.
조합 1. my_pow 부분2. 하는 이유3. % 숫자가 큰 경우에 이렇게 실행4. 어떤 규칙이 있음 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647#include using namespace std; #define DIV 1234567891typedef long long ll; ll fact[1000010];ll my_pow(ll base, ll exp) { ll res = 1; while (exp) { if (exp & 1) { res *= base; res %= DIV; } exp >>= 1; base *= base; base %= DIV; } res %= DIV; return res;} int ma.. 2019. 2. 3.
세제곱근을 찾아라 1. 세제곱근2. 이분 탐색3. 생각하던 풀이가 맞는지 ㅇㅇ 1234567891011121314151617181920212223242526272829303132333435#include long long N;long long result;int main(){ freopen("input.txt", "r", stdin); int testcase, testnum; scanf("%d", &testcase); for (testnum = 1; testnum 2019. 2. 1.
혜리의 숫자 나누기 1. 문제 확 안들어오면2. 몇 가지 예제를 가지고3. 규칙을 찾아서4. 이럴 때, 기저 사례를 빼놓지 않는 것이 중요함 123456789101112131415161718192021222324252627282930313233343536373839404142434445#include#define M 1000000007int n, m;#define MAX 10char x[MAX];int res;int cnt;int main(){ freopen("input.txt", "r", stdin); int t, tv = 0; int i, j, k; scanf("%d", &t); while (t--) { scanf("%d %d", &n, &m); scanf("%s", x); if (m == 1) { res = 1; fo.. 2019. 2. 1.
현주의 상자 바꾸기 1. 단순 배열 사용법2. 인덱스 사용하는 방법 1234567891011121314151617181920212223242526272829303132#include #define MAXN 1000#define MAX 10 int main(){ freopen("input.txt", "r", stdin); int t, T; int N, Q, L, R; scanf("%d", &T); for (t = 1; t 2019. 2. 1.