전체 글
-
CS50 Week6: Lab6, World cupProgramming/CS50 2023. 7. 18. 23:11
하버드 CS50 강의 6주차 Lab 과제 World Cup 의 풀이를 다룹니다.Python으로 작성한 FIFA 월드컵 시뮬레이션 프로그램입니다.Task문제 링크에서 자세한 내용을 확인할 수 있습니다.프로그램 실행 예시$ python tournament.py 2018m.csvBelgium: 20.9% chance of winningBrazil: 20.3% chance of winningPortugal: 14.5% chance of winningSpain: 13.6% chance of winningSwitzerland: 10.5% chance of winningArgentina: 6.5% chance of winningEngland: 3.7% chance of winningFrance: 3.3% chance..
-
CS50 Week5: Problem Set, SpellerProgramming/CS50 2023. 7. 18. 18:30
하버드 CS50 강의 5주차 Problem Set 과제 Speller 의 풀이 과정을 다룹니다.해시 테이블을 이용해 맞춤법 검사기를 만드는 문제입니다.C언어로 해시 테이블을 구현하며 해시 함수의 설계, 연결 리스트를 활용한 데이터 저장 방법 및 동적 메모리 할당을 연습합니다.Task문제 링크에서 자세한 내용을 확인할 수 있습니다.프로그램 실행 예시$ ./speller texts/lalaland.txtMISSPELLED WORDS[...]AHHHHHHHHHHHHHHHHHHHHHHHHHHHT[...]Shangri[...]fianc[...]Sebastians[...]WORDS MISSPELLED:WORDS IN DICTIONARY:WORDS IN TEXT:TIME IN load:TIME IN check:TIM..
-
CS50 Week5: Lab5, InheritanceProgramming/CS50 2023. 7. 18. 16:25
가족의 혈액형 구성하는 문제 $ ./inheritance Child (Generation 0): blood type OO Parent (Generation 1): blood type AO Grandparent (Generation 2): blood type OA Grandparent (Generation 2): blood type BO Parent (Generation 1): blood type OB Grandparent (Generation 2): blood type AO Grandparent (Generation 2): blood type BO Code // Simulate genetic inheritance of blood type #include #include #include #include /..
-
CS50 Week4: Problem Set, ReverseProgramming/CS50 2023. 7. 17. 17:15
하버드 CS50 강의 4주차 Poblem Set 과제 Reverse 의 풀이 과정을 다룹니다.바이너리 파일의 구조를 이해하고 데이터를 의미 있는 단위로 역순으로 처리해야 합니다.C언어로 파일 스트림의 위치를 제어하여 조작하는 문제입니다.Task문제 링크에서 자세한 내용을 확인할 수 있습니다.WAV 오디오 파일을 뒤집는 과제./reverse input.wav output.wavTemplate템플릿이 주어지며, 필요한 부분을 채워주면 됩니다.#include #include #include #include "wav.h"int check_format(WAVHEADER header);int get_block_size(WAVHEADER header);int main(int argc, char *argv[]){ ..
-
CS50 Week4: Problem Set, RecoverProgramming/CS50 2023. 7. 17. 13:50
하버드 CS50 강의 4주차 Poblem Set 과제 Recover 의 풀이 과정을 다룹니다.파일 시스템의 작동을 이해하고, C언어로 삭제된 파일을 복구하는 문제입니다.Intro메모리카드에서 jpg 파일을 복원하는 과제$ ./recover card.rawCode#include #include #include #include typedef uint8_t BYTE;// Digital camera FAT file block size: 512 Bytes const int BLOCK_SIZE = 512;bool has_JPEG_header(BYTE *buffer);int main(int argc, char *argv[]){ // Ensure proper usage if (argc != 2) { ..
-
CS50 Week4: Problem Set, FiltersProgramming/CS50 2023. 7. 14. 20:53
하버드 CS50 강의 4주차 Poblem Set 과제 Filters 의 풀이 과정을 다룹니다.C언어로 이차원 배열으로 표현된 이미지를 다루는 문제입니다.Intro문제 링크에서 자세한 내용을 확인할 수 있습니다.다양한 이미지 필터를 만드는 문제$ ./filter -r IMAGE.bmp REFLECTED.bmpCode다음 4가지 함수를 구현해야한다.grayscale: 이미지를 흑백으로 변환reflect: 이미지를 좌우 반전blur: 이미지를 흐리게 만듬edges: 이미지의 가장자리를 강조grayscale 함수RGB 값의 평균을 구해서 때려박는다.// Convert image to grayscalevoid grayscale(int height, int width, RGBTRIPLE image[height][w..
-
CS50 Week4: Lab4, VolumeProgramming/CS50 2023. 7. 10. 18:04
하버드 CS50 강의 4주차 Lab 과제 Volume 의 풀이 과정을 다룹니다.C언어로 wav 파일을 읽고 조작하는 문제입니다.Intro문제 링크에서 자세한 내용을 확인할 수 있습니다.주어진 wav 파일의 볼륨을 높이는 문제$ ./volume INPUT.wav OUTPUT.wav 2.0Template템플릿이 주어져서 필요한 부분만 채우면 된다.// Modifies the volume of an audio file#include #include #include // Number of bytes in .wav headerconst int HEADER_SIZE = 44;int main(int argc, char *argv[]){ // Check command-line arguments if (arg..
-
CS50 Week3: Problem Set, TidemanProgramming/CS50 2023. 7. 9. 19:01
하버드 CS50 강의 3주차 Problem Set 과제 Tideman 의 풀이 과정을 다룹니다.C언어로 정렬 알고리즘을 활용하고, 이차원 배열을 통해 그래프를 표현/탐색해야 하는 문제입니다.Intro문제 링크에서 자세한 내용을 확인할 수 있습니다.Ranked Pairs 선거 방식을 구현하는 문제$ ./tideman Alice Bob CharlieNumber of voters: 5Rank 1: AliceRank 2: CharlieRank 3: BobRank 1: AliceRank 2: CharlieRank 3: BobRank 1: BobRank 2: CharlieRank 3: AliceRank 1: BobRank 2: CharlieRank 3: AliceRank 1: CharlieRank 2: AliceR..