홍시홍의 프로그래밍

[백준 10871] X보다 작은 수 본문

알고리즘 문제풀이/백준

[백준 10871] X보다 작은 수

홍시홍 2020. 3. 19. 22:58

요구사항

X보다 작은 수 출력

 

풀이

1. X를 입력받는다

2. n가지 숫자 입력 받을때, x보다 작으면 출력

 

#include <iostream>
#include <queue>
#include <functional>
#include <algorithm>
#include <vector>
using namespace std;

priority_queue<int, vector<int>, greater<> > q;
int n, m;
vector<int> v;
int main() {
	scanf("%d%d", &n,&m);
	for (int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
		if (x < m) printf("%d ", x);
	}
	
}

'알고리즘 문제풀이 > 백준' 카테고리의 다른 글

[백준 1059] 수2  (0) 2020.03.20
[백준 2839] 설탕 배달  (0) 2020.03.20
[백준 9498] 시험 성적  (0) 2020.03.19
[백준 2075] N번째 큰 수  (0) 2020.03.19
[백준 1826] 연료 채우기  (0) 2020.03.19
Comments