[백준] 1436 영화감독 숌

0

백준

목록 보기
197/271
post-thumbnail
post-custom-banner

[백준] 1436 영화감독 숌

#include <iostream>
#include <string>
using namespace std;

typedef unsigned long long ull;

bool check(string str) {
	for (int i = 0; i < str.length() - 2; ++i) {
		if (str[i] == '6' && str[i + 1] == '6' && str[i + 2] == '6')
			return true;
	}
	return false;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

	int n;
	cin >> n;

	ull num = 666;
	int cnt = 0;
	while (true) {
		if (check(to_string(num))) 
			cnt++;

		if (cnt == n) break;
		else num++;
	}
	cout << num;
	return 0;
}
profile
Be able to be vulnerable, in search of truth
post-custom-banner

0개의 댓글