Skip to content

Instantly share code, notes, and snippets.

@yeopgi
Created August 28, 2021 05:29
Show Gist options
  • Save yeopgi/1fe4247fbcc5231c8e4dabf2a51a4fe0 to your computer and use it in GitHub Desktop.
Save yeopgi/1fe4247fbcc5231c8e4dabf2a51a4fe0 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int input;
cin >> input;
int movieSeries = 0;
for (int i = 666;; i++) {
int temp = i;
int isSequence = false;
while (temp) {
if (temp % 10 == 666) {
isSequence = true;
break;
}
temp = temp / 10;
}
if (isSequence) {
movieSeries++;
if (movieSeries == input) {
cout << i << '\n';
return 0;
}
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment