알고리즘

C++ 알고리즘 - 백준 1436 영화감독 숌

마루설아 2024. 12. 29. 12:11

https://www.acmicpc.net/problem/1436

 

#include <iostream>
#include <string>
#define endl "\n"

using namespace std;

int main(void) {
	// C++ Init
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	int input;
	int title = 666;
	string str;

	cin >> input;

	for (int i = 1; i < input; ) {
		title++;
		str = to_string(title);
		
		if (str.find("666") != string::npos) {
			i++;
		}
	}

	cout << title;
}