![[C++] 백준 20단계 - 18258번 문제 (큐 2)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2Fb2tf6X%2FbtsnaLTghlC%2FAAAAAAAAAAAAAAAAAAAAAKhMuj3ezqDD_BXqr7E5w39rEZSu1MW9EcGe27bnU0Pu%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DlT7dLrTGBhMhorx0%252F7eKXrDxxoI%253D)
문제설명 소스코드 #include #include using namespace std; int main() { ios_base::sync_with_stdio(false); //표준 스트림 동기화 해제 cin.tie(NULL); //입력과 출력 연결 끊기 queue que; string command; int N; cin >> N; for (int i = 0; i > command; if (command == "push") { int X; cin >> X; que.push(X); } else if (command == "pop") { if (que.empty()) cout
![[C++] 백준 - 10845번 문제 (큐)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2Fz2KLK%2FbtsluTzf4Iy%2FAAAAAAAAAAAAAAAAAAAAAKPXbt9Wa1xp1yKpxox8hb7mkjY6tcRZwN9dwnn89FZs%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3Dt9b2fWphSnbO7CWdoXBS03FuorQ%253D)
문제설명 소스코드 #include using namespace std; int max = 10000; //큐 용량 int num = 0; //현재 데이터 수 int que[10000]; bool isFull() { return ::num >= ::max; } //큐의 공간이 모두 사용중인지 리턴 bool isEmpty() { return ::num 0) return que[0]; } int main() { int N; cin >> N; for (int i = 0; i > command; if (command == "push") { cin >> value; enque(value); } else if (command ==..
![[C++] 백준 6단계 - 4344번 문제 (평균은 넘겠지)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FUeypj%2Fbtr9PeO7imB%2FAAAAAAAAAAAAAAAAAAAAAB7bpTwuiPlqnNXU1sJcsQWysPziIAo0akc_1OSXmsey%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DlZzyQ1Jt6E7zAK%252B9V2%252F%252BjLTXS8o%253D)
23.06.26 재채점 결과 반영 이전에는 맞았지만 재채점후 틀린 이유는 https://www.acmicpc.net/board/view/119087때문이다. 따라서 반올림 함수인 round()를 이용하여 다시 풀었다. 문제설명 소스코드 #include #include //round 함수를 쓰기위해 using namespace std; int main() { int tmp; int N; cin >> N; tmp = N; for (int i = 0; i > N; int* arr = new int[N]; //동적할당 float avg = 0; int count = 0; //평균을 넘는 사람의 수를 저장 for (int j = 0; j > arr[..
![[C++] 백준 12단계 - 2231번 문제 (분해합)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2Fm9vML%2FbtslaHtavAW%2FAAAAAAAAAAAAAAAAAAAAAOOLUUz7hQJMHQfQNp6T5xQPCbtGqWcM3x-KYvZZtRC0%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DgYzARv6fNxN%252FIh%252FuP4RLC%252FXi7z0%253D)
문제설명 소스코드 #include #include using namespace std; int main() { int N; int ans = 0; cin >> N; for (int i = 1; i < N; ++i) { string str = to_string(i); //i를 문자열로 바꿈 string* arr = new string[str.length()]; //i의 자리수 만큼 string 타입 배열 동적할당 for (int j = 0; j < str.length(); ++j) arr[j] = str[j]; //i의 각 자리수를 복사 int sum = i; //분해합에선 자기 자신을 더해야하므로 for (int j = 0; j < str.length(); ++j) sum += stoi(arr[j]); ..
![[C++] 백준 12단계 - 2798번 문제 (블랙잭)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FbyNiOa%2FbtsljgHyKZ6%2FAAAAAAAAAAAAAAAAAAAAAFBpWul9Sg7iDDu8iTMI2nKNSLld8qnU2Na8nd48NVai%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3D6XQ6MII3dvhuOw43vypcXC%252F6pt4%253D)
문제설명 소스코드 #include using namespace std; int main() { int N, M, ans; int sum = 0; int margin = 300000; //M과 세 수의 합의 최대 차이는 300000이므로 cin >> N >> M; int* arr = new int[N]; //동적 할당 for (int i = 0; i > arr[i]; for (int i = 0; i = 0) && (M - sum..
![[C++] 백준 19단계 - 18028번 문제 (스택)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FOc2DY%2Fbtslb57SCyi%2FAAAAAAAAAAAAAAAAAAAAAG3MtpeeUYYsvxMP7RpyeiwXG5hZ6v1xaAY7L8rBvqJw%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3D%252BK%252FMA%252Bc93PsHiXz6CHHN8ObEm6E%253D)
문제설명 소스코드 #include using namespace std; int max_stack = 10000; int ptr = 0; int stk[10000]; bool isFull() { return ptr >= max_stack; } bool isEmpty() { return ptr
![[JAVA] 백준 - 11282번 문제 (한글)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FPgYmw%2FbtslaGNpaZm%2FAAAAAAAAAAAAAAAAAAAAAMuO8mzErgymsU8-YA3nURnEUCW-YTBudI4GowZwSIjF%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DtJAKqaFGQBtyzOsaz1LlnVN63uA%253D)
문제설명 소스코드 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println((char)(sc.nextInt()-1+'가')); } } 설명 import java.util.*; public class Main { public static void main(String[] args) { System.out.println((char)44032 + " = " + (int)'가'); for(int i = 0; i < 11172; ++i){ if(i % 50 == 0)System.out.println(); System.out.pr..
![[C++] 백준 - 13416번 문제 (주식 투자)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FpsUvX%2Fbtsk3sg7ahg%2FAAAAAAAAAAAAAAAAAAAAAAuLEWXNuLH348jRdCOn2XYp9OHmEr_QFlWl83hF2vzY%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DE87iW9xgJrT6%252FGf5g2ZOFnuKpDw%253D)
문제설명 소스코드 #include using namespace std; int main() { int T; int N; int sum = 0; cin >> T; for (int i = 0; i > N; int** arr = new int* [N]; //N개의 배열 동적할당 for (int k = 0; k > arr[j][k]; if (arr[j][k] > dm) dm = arr[j][k]; // 당일 이익 최고가 저장 } sum += dm..