백준 10871번 X보다 작은 수
문제
문제 출처 : https://www.acmicpc.net/problem/10871
C++ 소스코드
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int j=0; | |
int main() | |
{ | |
int N,X; | |
cin >> N >> X; | |
int arr[10001] = { 0 }; | |
int arr2[10001] = { 0 }; | |
for (int i = 0; i < N; i++) | |
{ | |
cin >> arr[i]; | |
} | |
for (int i = 0; i < N; i++) | |
{ | |
if (arr[i] < X) | |
{ | |
arr2[j] = arr[i]; | |
j++; | |
} | |
} | |
for (int i = 0; i < j; i++) | |
{ | |
cout << arr2[i] << " "; | |
} | |
} |
댓글남기기