전체 글

전체 글

    [C로 쓴 자료구조론] Polynomial

    #define MAX_TERMS 100#include #include typedef struct { float coef; int expon;}polynomial;polynomial terms[MAX_TERMS];int avail = 0;int compare(int a, int b) { if (a b) return 1; return 0;}void attach(float coef, int expon) { if (avail >= MAX_TERMS) { fprintf(stderr, "fail"); exit(1); } terms[avail].coef = coef; terms[avail++].expon = expon;}void padd(int startA, int endA, int startB, int end..

    [C로 쓴 자료구조론] Mazing Problem

    C로 쓴 자료구조론 | Ellis Horowitz 책에 있는 미로 찾기 문제 코드입니다주의 할 부분은 path() 함수 내에 있는 top = 0 입니다.처음 코드 작성하는데 저게 스택이 int top = 0 으로 시작하는 줄 알고 push() 와 pop()을 작성하였는데, 알고보니 stack[0] 을 초기화 해주면서 top이 증가했음을 알려주는 것 이였습니다.저 처럼 삽질하지 마시길 바랍니다.#include #include #define MAX_STACK_SIZE 100#define EXIT_ROW 4#define EXIT_COL 4#define TRUE 1#define FALSE 0typedef struct { short int x; short int y;} offset;offset move..

    gather id

    # 갤러리 고정닉네임 사용자 ID 크롤링 import asyncio import dc_api async def main(): async with dc_api.API() as api: for i in range(1, 100000): try: async for index in api.board(board_id="projectmx", num=-1, start_page=i, document_id_upper_limit=None, document_id_lower_limit=None, is_minor=False): doc = await index.document() if doc.author_id == None: None else: print(doc.author_id) except : pass await main()

    automatically post at dcinside

    https://github.com/eunchuldev/dcinside-python3-api import dc_api import asyncio async def main(): api = dc_api.API() # Write a document doc_id = await api.write_document(board_id="api", title="알비(Rb, 구상민, 前 Team 이카루스) 님 댓글 '사기리'가 뭐지?", contents="알비(Rb, 구상민, 前 Team 이카루스) 님 댓글 '사기리'가 뭐지?", name="개구리님", password="4414") print(f"Document ID: {doc_id}") await api.close() async def run_repeatedly(): w..

    컴사파 - 9주차

    8.1 파일에 저장된 학생 정보 처리 student_records.txt Lee 80 90 95 90 Kim 85 75 70 95 Park 70 80 90 85 Hong 90 85 95 85 Yoon 85 85 95 80 output.txt name : kor, eng, math, sci, sum, avg ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ Lee : 80, 90, 95, 90, 355, 88.75 Kim : 85, 75, 70, 95, 325, 81.25 Park : 70, 80, 90, 85, 325, 81.25 Hong : 90, 85, 95, 85, 355, 88.75 Yoon : 85, 85, 95, 80, 345, 86.25 ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐..

    컴사파 - 7주차

    어떻게함? 7.1 class Person, class Student- ## 22211975_homework7 """ Project: 22211975_homework7.1 Author: Date of last update: 22.10.16 Update list: -v1.0: added user-defined module """ class Person: def __init__(self, name, reg_id, age): self.setName(name) self.setRegID(reg_id) self.setAge(age) def getName(self): return self.name def getRegID(self): return self.reg_id def getAge(self): return self..

    220926 - Univ

    자료형의 크기 #include int main(void) { int x; printf("변수 x 의 크기:%d \n", sizeof(x)); printf("int형의 크기: %d \n", sizeof(int)); printf("char형의 크기: %d \n", sizeof(char)); printf("short형의 크기: %d \n", sizeof(short)); printf("long형의 크기: %d \n", sizeof(long)); printf("float형의 크기: %d \n", sizeof(float)); printf("double형의 크기: %d \n", sizeof(double)); return 0; } ASCII #include int main() { char ch1 = 'A', ch2 =..

    컴사파 - 6주차

    패키지 # MyList.py """ Project: MyList.py Package Author: Date of last update: 22.10.04 Update list: -v1.0: added genRandList, printListSample, shufflelist """ import random def genRandList(L, n): for i in range(n+1): Rand = random.randint(0, n) while Rand in L: Rand = random.randint(0, n) else: L.append(Rand) return L def printListSample(L, n, per_line, sample_lines): last_list = n % 20 cnt = 0 fo..