근본없는 코딩

[C++] 백준 10810 공넣기 본문

✔ Online Judge

[C++] 백준 10810 공넣기

근본없는 개발자 2023. 6. 9. 20:25

#include <iostream>
using namespace std;

int main() {

	int n, m;
	int arr[100] = { 0 };
	int i, j, k;
	cin >> n >> m;

	for (int x = 0; x < m; x++) {
		cin >> i >> j >> k;
		for (int y = i-1; y < j; y++) {
			arr[y] = k;
		}
	}
	
	for (int x = 0; x < n; x++) { 
		cout << arr[x] << ' ';
	}


	return 0;
}

'✔ Online Judge' 카테고리의 다른 글

[C++] 백준 5597 과제 안 내신 분..?  (0) 2023.06.09
[C++] 백준 10813 공 바꾸기  (0) 2023.06.09
[C++] 백준 2562 최댓값  (0) 2023.06.09
[C++] 백준 10818 최소, 최대  (0) 2023.06.09
[C++] 백준 10871 X보다 작은 수  (0) 2023.06.09