본문 바로가기

전체 글92

2일차 2020-09-03 초급 : 11719 그대로 출력하기 2 (Bronze I) www.acmicpc.net/problem/11719 11719번: 그대로 출력하기 2 입력이 주어진다. 입력은 최대 100줄로 이루어져 있고, 알파벳 소문자, 대문자, 공백, 숫자로만 이루어져 있다. 각 줄은 100글자를 넘지 않으며, 빈 줄이 주어질 수도 있고, 각 줄의 앞 뒤에 공백이 www.acmicpc.net #include #include using namespace std; int main() { string s; while (getline(cin, s)) { cout 2020. 9. 5.
1일차 2020-09-02 초급 : 19575 Polynomial (Bronze I) www.acmicpc.net/problem/19575 19575번: Polynomial 경근이는 수학을 좋아한다. 수학을 너무 좋아하는 나머지 다항식을 빠르게 평가하는 프로그램을 작성했다. 미지수 x로 구성된 다항식 f(x)에서 x에 k를 대입하여 f(k)를 구하는 것을 평가라고 한다 www.acmicpc.net #include using namespace std; long long N, x, a, b, r = 0; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N >> x; while (N-- >= 0) { cin >> a >> b; r *= x;.. 2020. 9. 5.
Trie #include using namespace std; const int childMax = 26; const char baseChar = 'A'; struct Trie { Trie* child[childMax]; // 'A' ~ 'Z' bool isRet, isParent; Trie() { fill(child, child + childMax, nullptr); isRet = isParent = false; } ~Trie() { for (int i = 0; i < childMax; ++i) { if (child[i]) delete child[i]; } } void insert(const char* key) { if (*key == '\0') isRet = true; else { int next = *key.. 2020. 9. 4.
200904 github 한 폴더에 파일이 1000개가 넘어가면 다 안 보여준단다.. 그래서 문제 번호 앞 두 자리를 기준으로 폴더별로 정리해서 다시 올렸다. 깔끔하니 보기 좋다. import os import shutil from pathlib import Path def getF(dir): ret = [] for p in Path(dir).iterdir(): if p.is_file(): ext = str(p).split(".")[-1] if ext in ["txt"]: ret.append(str(p)) return ret def getN(fp): ret = [] for p in fp: ret.append(str(p).split("\\")[-1]) return ret fLi = getF(Path.cwd()) nLi.. 2020. 9. 4.
JSP Beans 프로그래밍 및 Action Tag 활용 + - JSP로 작성된 input이 위와 같을 때, /// Cal.java package myBean; public class Cal { private int num1; private int num2; private String oper; public Cal() { num1 = 0; num2 = 0; oper = ""; } // get, set method public int getNum1() { return num1; } public int getNum2() { return num1; } public String getOper() { return oper; } public void setNum1(int num1) { this.num1 = num1; } public void setNum2(int num2.. 2020. 9. 2.
1주차 2 Binary Coded Decimal (BCD) 874 > 1000 0111 0100 수 체계가 아니고 단순히 십진수를 이진수 꼴로 나타낸 것. 속도 측면에서 유리하지만, straight binary에 비해 연산에 불리하다. Gray Code 001 > 001 > 011 > 010 > 110 > 111 > 101 > 100 수를 표현할 때 한 비트씩만 바꾸어 오류 확률을 낮춘다. Gray Code와 Binary 변환 회로 Quadrature Encoder 검색해서 보는게 낫다 Parity Error Detection 사용 예시 - ASCII Code 는 7비트이고, 앞에 Parity bit를 추가하여 총 1의 개수를 짝수 또는 홀수로 맞춘다. 보통 짝수로 맞추는 것이 일반적이라고 한다. MIME (Mul.. 2020. 9. 2.