알고리즘 136

C++ 알고리즘 - 백준 1015 수열 정렬

https://www.acmicpc.net/problem/1015 #include #define endl "\n"using namespace std;/******** 전역변수 ********/int B[52];int P[52];/******** 함 수 ********/int main(void) { /******** C++ INIT ********/ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); /******** 지역변수 ********/ int input1; int input2; int num = 0; /******** 구 현 ********/ cin >> input1; // B 배열에 숫자 입력 for (int i = 0; i >..

알고리즘 2025.02.21
C++ 알고리즘 - 백준 11052 카드 구매하기

https://www.acmicpc.net/problem/11052 #include #define endl "\n"using namespace std;/******** 전역변수 ********/int card[1002];int answer[1002];/******** 함 수 ********/int main(void) { /******** C++ INIT ********/ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); /******** 지역변수 ********/ int input1; int input2; /******** 구 현 ********/ cin >> input1; // 카드팩 가격 입력 for (int i = 1; i > in..

알고리즘 2025.02.21
C++ 알고리즘 - 백준 1244 스위치 켜고 끄기

https://www.acmicpc.net/problem/1244 #include #define endl "\n"using namespace std;/******** 전역변수 ********//******** 함 수 ********/int main(void) { /******** C++ INIT ********/ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); /******** 지역변수 ********/ int input1; int input2; int state; int sexual; int number; vector light; /******** 구 현 ********/ cin >> input1; // 스위치 상태 벡터에 삽입 fo..

알고리즘 2025.02.10