본문 바로가기

전체 글

윤년 답안 - 함수로 분할 #include int isLeap(int year);//윤년인지 구분해주는 함수int yearDay(int year, int month, int day);//그 해의 몇번째 날인지 계산하는 함수int totalDay(int year, int month, int day);//1900년 부터 총 날짜를 계산하는 함수int Week(int total);//요일을 반환하는 함수int main() {int year, month, day;//년 월 일을 입력받을 함수char week[7][5] = { {"일"}, {"월"}, {"화"}, {"수"}, {"목"}, {"금"}, {"토"} };//요일을 초기화char leap[2][3] = { {"평"}, {"윤"}};int total = 0;//년 월 일 입력pri.. 더보기
[C++] 백준 1076번 : 저항 https://www.acmicpc.net/problem/1076 #include #include #include using namespace std; long long detector(string a); int main() {string str1;string str2;string str3;cin >> str1;cin >> str2;cin >> str3;if (detector(str1) != -1 && detector(str2) != -1 && detector(str3) != -1){long long n = (detector(str1) * 10 + detector(str2))*pow(10, detector(str3));cout 더보기
[C++] 백준 1037번 : 약수 https://www.acmicpc.net/problem/1037 #include #include #include using namespace std; int main() {int tc,tmp;vector n;cin >> tc; for (int i = 0; i > tmp;n.push_back(tmp);}sort(n.begin(), n.end());cout 더보기
[C++] 백준 1977번 : 완전제곱수 https://www.acmicpc.net/problem/1977 #include #include using namespace std; int main() { int n1, n2;cin >> n1 >> n2;////int i = sqrt(n1);//int tmp = sqrt(n1);//tmp *= tmp;////tmp = n1 ? i++ : 0; int flag = 0, sum =0,min=0; for (int i = n1; i 더보기
[C++] 백준 2010번 : 플러그 https://www.acmicpc.net/problem/2010 #include using namespace std; int main() {int tc;cin >> tc;int n,cnt =0;for (int i = 0; i > n;cnt += n - 1;}cin >> n;cnt += n; cout 더보기
공모전 공모전 https://cafe.naver.com/outcampus/ 한눈에 보이는 이캠->공모전 리스트 더보기
Operating System - Chapter3 What is process? Definitions - A program in execution- An instance of a program running on a computer- The entity that can be assigned to and executed on a processor- 명령들의 순차 수행, 현재상태, 연계된 시스템 자원들의 집합등에 의해 특징지어지는 활동단위(A unit of activity) Structures - Program code - a set of data- process information PCB(Process Control Block)- managed by OS - 수행 프로세스를 인터럽트한 후, 프로세스 수행을 재개할 수 있도록 정보 유지- Process =.. 더보기
DataStructure - Prim 의 MST 알고리즘 Prim 의 MST 알고리즘 Prim의 알고리즘은 하나의 정점에서부터 시작하여 트리를 단계적으로 확장해나가는 방법이다. 처음에는 시작 정점많이 트리에 포함된다. 다음으로 지금까지 만들어진 트리에 인접한 정점들 중에서 간선의 가중치가 가장 작은 정점을 선택하여 트리를 확장한다. 이 과정은 트리가 n-1ㅐ의 간선을 가질 때까지 계속된다. Prim의 알고리즘을 자연어로 나타내면 알고리즘은 아래와 같다. | Prim의 최소 비용 신장 트리 알고리즘 Prim( ) 1. 그래프에서 시작 정점을 선택하여 초기 트리를 만든다.2. 현재 트리의 정점들과 인접한 정점들 중에서 간선의 가중치가 가장 작은 정점 v 를 선택한다.3. 이 정점 v와 이때의 간선을 트리에 추가한다.4. 모든 정점이 삽입될 때 까지 2번으로 이동한.. 더보기